Skip to content

Commit dc60fdf

Browse files
Update pyiceberg/io/pyarrow.py
Co-authored-by: Fokko Driesprong <fokko@apache.org>
1 parent 27eb31b commit dc60fdf

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

pyiceberg/io/pyarrow.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,13 +1676,8 @@ def _task_to_record_batches(
16761676
# Create the mask of indices that we're interested in
16771677
indices = _combine_positional_deletes(positional_deletes, current_index, current_index + len(batch))
16781678
current_batch = current_batch.take(indices)
1679-
if pyarrow_filter is not None:
1680-
try:
1681-
current_batch = current_batch.filter(pyarrow_filter)
1682-
except IndexError:
1683-
# PyArrow < 21 raises IndexError when filter produces zero rows
1684-
# (fixed in https://github.com/apache/arrow/pull/46057)
1685-
current_batch = current_batch.slice(0, 0)
1679+
if pyarrow_filter is not None and len(current_batch) > 0:
1680+
current_batch = current_batch.filter(pyarrow_filter)
16861681

16871682
# skip empty batches
16881683
if current_batch.num_rows == 0:

0 commit comments

Comments
 (0)