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

[C++][Python] Allow to reconstruct a ListArray with ListArray.from_arrays and keep the nulls

Details

    Description

      Hi ! Right now when one wants to reconstruct a ListArray using ListArrar.from_arrays, the `null` values may be lost:

      import pyarrow as pa
      
      arr = pa.array([None, [0]])
      reconstructed_arr = pa.ListArray.from_arrays(arr.offsets, arr.values)
      print(reconstructed_arr.to_pylist())
      # [[], [0]] 

      It would be nice to have a `mask` parameter to `ListArray.from_arrays` (or any way to provide the validity bitmap) to be able to reconstruct the original array with the `null` values.

      It would also be consistent with `StructArray.from_arrays` that already has the `mask` parameter.

      Attachments

        Issue Links

          Activity

            People

              milesgranger Miles Granger
              lhoestq quentin lhoest
              Votes:
              1 Vote for this issue
              Watchers:
              5 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 - 4h 10m
                  4h 10m

                  Slack

                    Issue deployment