AlenkaF commented on code in PR #46057:
URL: https://github.com/apache/arrow/pull/46057#discussion_r2034684720
##########
python/pyarrow/acero.py:
##########
@@ -374,7 +374,7 @@ def _filter_table(table, expression):
Declaration("filter", options=FilterNodeOptions(expression))
])
result = decl.to_table(use_threads=True)
- if is_batch:
+ if is_batch and result.num_rows > 0:
Review Comment:
With this check we will return an empty `Table` instead of an empty
`RecordBatch`. We might use try and catch or add an additional else so that in
case the the input is a `RecordBatch` and the filtering result is empty, we
still return an empty `RecordBatch`.
##########
python/pyarrow/tests/test_acero.py:
##########
@@ -115,6 +115,14 @@ def test_filter(table_source):
FilterNodeOptions(None)
+def test_filter_all_rows():
Review Comment:
Can we add a check that the result is a `RecordBatch`? And maybe a test with
the `Table` as an input for the empty filtering result so we are sure not to
break anything there.
--
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]