gabeiglio commented on code in PR #1621: URL: https://github.com/apache/iceberg-python/pull/1621#discussion_r1948234324
########## pyiceberg/io/pyarrow.py: ########## @@ -1359,14 +1359,11 @@ def _task_to_record_batches( # Apply the user filter if pyarrow_filter is not None: - # we need to switch back and forth between RecordBatch and Table - # as Expression filter isn't yet supported in RecordBatch - # https://github.com/apache/arrow/issues/39220 - arrow_table = pa.Table.from_batches([batch]) - arrow_table = arrow_table.filter(pyarrow_filter) - if len(arrow_table) == 0: + if batch.num_rows == 0: continue - output_batches = arrow_table.to_batches() + filtered_batch = batch.filter(pyarrow_filter) + if filtered_batch.num_rows > 0: + output_batches = [filtered_batch] Review Comment: The check if the batch is empty is inside the `if positional_deletes` block, so if there are no positional deletes then it will hit directly the `if pyarrow_filter is not None` line without checking if the batch is empty. Unless I am incorrectly interpreting that the `if pyarrow_filter` block is outside of `if positional_deletes:` -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org