Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-6506

[C++] Validation of ExtensionType with nested type fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.15.0
    • C++

    Description

      A reproducer using the Python ExtensionType:

      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) 
      

      then validating this array fails because it expects no children (the extension array itself has no children, only the storage array):

      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
      

      Attachments

        Issue Links

          Activity

            People

              jorisvandenbossche Joris Van den Bossche
              jorisvandenbossche Joris Van den Bossche
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2.5h
                  2.5h