wjones127 commented on PR #14198:
URL: https://github.com/apache/arrow/pull/14198#issuecomment-1254350080
## Mapping MapType field names
```python
import pyarrow as pa
# MapType
ty_named = pa.map_(pa.field("x", pa.int32(), nullable=False), pa.int32())
ty = pa.map_(pa.int32(), pa.int32())
arr_named = pa.array([[(1, 2), (2, 4)]], type=ty_named)
arr_named.type, arr_named.cast(ty).type
```
**Before (wrong)**
```python
(MapType(map<int32 ('x'), int32>), MapType(map<int32 ('x'), int32>))
```
**After (correct)**
```python
(MapType(map<int32 ('x'), int32>), MapType(map<int32, int32>))
```
## Mapping Map<T, List<T>> names
```python
ty_named = pa.map_(pa.string(), pa.field("x", pa.list_(pa.field("x",
pa.int32(), nullable=True)), nullable=False))
ty = pa.map_(pa.string(), pa.list_(pa.int32()))
arr_named = pa.array([[("string", [1, 2, 3])]], type=ty_named)
arr_named.type, arr_named.cast(ty).type
```
**Before**
```python
pyarrow.lib.ArrowNotImplementedError: Unsupported cast from map<string,
list<x: int32> ('x')> to map<string, list<item: int32>> (no available cast
function for target type)
```
**After**
```python
(MapType(map<string, list<x: int32> ('x')>), MapType(map<string, list<item:
int32>>))
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]