0x26res opened a new issue, #15078: URL: https://github.com/apache/arrow/issues/15078
### Describe the enhancement requested I would like to be able to create MapArray, using the from_array function, and: 1. specify missing value (by that I mean the whole map is null), by passing a `mask` argument 2. specify that each individual map values are not nullable, by passing a `type` argument This would make [pa.MapArray.from_array](https://arrow.apache.org/docs/python/generated/pyarrow.MapArray.html#pyarrow.MapArray.from_arrays) similar to [pa.ListArray.from_array](https://arrow.apache.org/docs/python/generated/pyarrow.ListArray.html#pyarrow.ListArray.from_arrays) Here's an example of what I am trying to do. 1. Can't create a map array with missing values Using `pa.array` I can create a MapArray with a null value: ``` array_from_python = pa.array([[], None, [(1, None), (2, "2")]], map_type) ``` But I can't do it with `pa.MapArray.from_arrays`, because I can't pass a mask ``` array_from_arrays = pa.MapArray.from_arrays( pa.array([0, 0, 0, 2], pa.int32()), pa.array([1, 2]), pa.array([None, "2"]), ) ``` I could not find a workaround for this one, `replace_with_mask` isn't supported for MapArray it seems: ``` pc.replace_with_mask( array_from_arrays, array_from_python.is_null(), pa.scalar(None, array_from_arrays.type) ) ``` 2. Can't pass the type of the map array: There is a niche use case where one would have to specify the type of the array. That's when one wants to specify if individual values of the maps are not nullable (or if one want to change the name of the key/value fields of the map): ``` array_from_arrays = pa.MapArray.from_arrays( pa.array([0, 0, 0, 2], pa.int32()), pa.array([1, 2]), pa.array(["1", "2"]), type=pa.map_(pa.int64(), pa.field("value", pa.string(), nullable=False)) ) ``` For the moment, I can workaround this problem by casting the map array. ### Component(s) Python -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org