Fokko opened a new issue, #35748:
URL: https://github.com/apache/arrow/issues/35748

   ### Describe the enhancement requested
   
   At PyIceberg we're relying heavily on Arrow for reading the data. This 
includes Iceberg positional deletes. A positional deletes file will tell which 
indices are deleted in a parquet file. There can be one or more arrays telling 
which indices are deleted. The arrays are already sorted, and ideally it also 
deduplicates the numbers:
   
   ```python
   import pyarrow as pa
   
   a1 = pa.chunked_array([[1, 2, 3], [6, 7]])
   a2 = pa.chunked_array([[4, 7, 8]])
   
   # [1, 2, 3, 4, 6, 7, 8]
   pa.merge_arrays(a1, a2)
   ```
   
   The result can be an array or a chunked array, but that's up to the 
implementer what's most efficient.
   
   Currently we use:
   ```
   In [2]: from heapq import merge
      ...: import pyarrow as pa
      ...: 
      ...: a1 = pa.chunked_array([[1, 2, 3], [6, 7]])
      ...: a2 = pa.chunked_array([[4, 7, 8]])
      ...: 
      ...: list(merge(*[a1, a2], key=lambda e: e.as_py()))
   Out[2]: 
   [<pyarrow.Int64Scalar: 1>,
    <pyarrow.Int64Scalar: 2>,
    <pyarrow.Int64Scalar: 3>,
    <pyarrow.Int64Scalar: 4>,
    <pyarrow.Int64Scalar: 6>,
    <pyarrow.Int64Scalar: 7>,
    <pyarrow.Int64Scalar: 7>,
    <pyarrow.Int64Scalar: 8>]
   ```
   
   ### Component(s)
   
   Python


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to