jorisvandenbossche commented on a change in pull request #10981:
URL: https://github.com/apache/arrow/pull/10981#discussion_r694842266
##########
File path: python/pyarrow/types.pxi
##########
@@ -2349,12 +2363,23 @@ cpdef MapType map_(key_type, item_type,
keys_sorted=False):
map_type : DataType
"""
cdef:
- DataType _key_type = ensure_type(key_type, allow_none=False)
- DataType _item_type = ensure_type(item_type, allow_none=False)
+ Field _key_field
+ Field _item_field
shared_ptr[CDataType] map_type
MapType out = MapType.__new__(MapType)
- map_type.reset(new CMapType(_key_type.sp_type, _item_type.sp_type,
+ if isinstance(key_type, Field):
+ _key_field = key_type
Review comment:
I was quickly trying this out, and it seems we crash if the field is not
exactly named "key" ànd nullable=False (->
https://issues.apache.org/jira/browse/ARROW-13735). The field name is something
we shouldn't be strict about (since the specification says this can be named
differently), but so for nullability I think we should check this.
--
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]