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

[C++][Python] Auto chunking nested array containing binary-like fields result malformed output

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 2.0.0
    • C++, Python
    • None

    Description

      In case of nested types the binary-like arrays are chunked but not the others, so after finalizing the builder the nested output array contains different length children.

         char = b'x'
         ty = pa.binary()
      
          v1 = char * 100000000
          v2 = char * 147483646
      
          struct_type = pa.struct([
              pa.field('bool', pa.bool_()),
              pa.field('integer', pa.int64()),
              pa.field('string-like', ty),
          ])
      
          data = [{'bool': True, 'integer': 1, 'string-like': v1}] * 20
          data.append({'bool': True, 'integer': 1, 'string-like': v2})
          arr = pa.array(data, type=struct_type)
          assert isinstance(arr, pa.Array)
      
          data.append({'bool': True, 'integer': 1, 'string-like': char})
          arr = pa.array(data, type=struct_type)
          assert isinstance(arr, pa.ChunkedArray)
      
      len(arr.field(0)) == 22
      len(arr.field(1)) == 22
      len(arr.field(2)) == 1  # the string array gets chunked whereas the rest of the fields do not
      

      Attachments

        Issue Links

          Activity

            People

              kszucs Krisztian Szucs
              kszucs Krisztian Szucs
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: