kevinjqliu commented on code in PR #1621:
URL: https://github.com/apache/iceberg-python/pull/1621#discussion_r1948232906


##########
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:
   `current_batch` inside the `if pyarrow_filter is not None` shouldnt be 
empty, right? 
   because if it is, it would have been skipped



-- 
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

Reply via email to