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

[C++] MakeArrayOfNull makes invalid ListArray

    XMLWordPrintableJSON

Details

    Description

      One way to reproduce this bug is:

       

      >>> a = pa.array([[1, 2]])

      >>> b = pa.array([None, None], type=pa.null())

      >>> t1 = pa.Table.from_arrays([a], ["a"])
      >>> t2 = pa.Table.from_arrays([b], ["b"])

       

      >>> pa.concat_tables([t1, t2], promote=True)
      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "pyarrow/table.pxi", line 2138, in pyarrow.lib.concat_tables
      File "pyarrow/public-api.pxi", line 390, in pyarrow.lib.pyarrow_wrap_table
      File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status
      pyarrow.lib.ArrowInvalid: Column 0: In chunk 1: Invalid: List child array invalid: Invalid: Buffer #1 too small in array of type int64 and length 2: expected at least 16 byte(s), got 12

      (because concat_tables(promote=True) will call MakeArrayOfNulls (https://github.com/apache/arrow/blob/ec3bae18157723411bb772fca628cbd02eea5c25/cpp/src/arrow/table.cc#L647))

       

      The code here seems incorrect:

      https://github.com/apache/arrow/blob/ec3bae18157723411bb772fca628cbd02eea5c25/cpp/src/arrow/array/util.cc#L218

      the length of the child array of a ListArray may not equal to the length of the ListArray.

      Attachments

        Issue Links

          Activity

            People

              brillsp Zhuo Peng
              brillsp Zhuo Peng
              Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 40m
                  40m