You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "kevinjqliu (via GitHub)" <gi...@apache.org> on 2024/10/28 22:24:36 UTC

Re: [I] explore removing `numpy` as a dependency [iceberg-python]

kevinjqliu commented on issue #1259:
URL: https://github.com/apache/iceberg-python/issues/1259#issuecomment-2442788004

   This ChatGPT-generated function seems to be logically equivalent. And pass integration tests. 
   But we should double check this 
   
   ```
   def _combine_positional_deletes(positional_deletes: List[pa.ChunkedArray], start_index: int, end_index: int) -> pa.Array:
       if len(positional_deletes) == 1:
           all_chunks = positional_deletes[0]
       else:
           all_chunks = pa.chunked_array(itertools.chain(*[arr.chunks for arr in positional_deletes]))
       
       # Create the full range array with pyarrow
       full_range = pa.array(range(start_index, end_index))
       
       # Filter out values in all_chunks from full_range
       result = pc.filter(full_range, pc.invert(pc.is_in(full_range, value_set=all_chunks)))
       
       # Subtract the start_index from each element in the result
       adjusted_result = pc.subtract(result, pa.scalar(start_index))
       
       return adjusted_result
   ```


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org