Joris Van den Bossche created ARROW-6506:
--------------------------------------------
Summary: [C++] Validation of ExtensionType with nested type fails
Key: ARROW-6506
URL: https://issues.apache.org/jira/browse/ARROW-6506
Project: Apache Arrow
Issue Type: Bug
Components: C++
Reporter: Joris Van den Bossche
Fix For: 0.15.0
A reproducer using the Python ExtensionType:
{code}
class MyStructType(pa.ExtensionType):
def __init__(self):
storage_type = pa.struct([('a', pa.int64()), ('b', pa.int64())])
pa.ExtensionType.__init__(self, storage_type, 'my_struct_type')
def __arrow_ext_serialize__(self):
return b''
@classmethod
def __arrow_ext_deserialize__(self, storage_type, serialized):
return MyStructType()
ty = MyStructType()
storage_array = pa.array([{'a': 1, 'b': 2}], ty.storage_type)
arr = pa.ExtensionArray.from_storage(ty, storage_array)
{code}
then validating this array fails because it expects no children (the extension
array itself has no children, only the storage array):
{code}
In [8]: arr.validate()
---------------------------------------------------------------------------
ArrowInvalid Traceback (most recent call last)
<ipython-input-8-13783ce9f25e> in <module>
----> 1 arr.validate()
~/scipy/repos/arrow/python/pyarrow/array.pxi in pyarrow.lib.Array.validate()
~/scipy/repos/arrow/python/pyarrow/error.pxi in pyarrow.lib.check_status()
ArrowInvalid: Expected 0 child arrays in array of type
extension<my_struct_type>, got 2
{code}
--
This message was sent by Atlassian Jira
(v8.3.2#803003)