jorisvandenbossche commented on code in PR #13409:
URL: https://github.com/apache/arrow/pull/13409#discussion_r1037912092
##########
python/pyarrow/_dataset.pyx:
##########
@@ -385,6 +416,32 @@ cdef class Dataset(_Weakrefable):
"""The common schema of the full Dataset"""
return pyarrow_wrap_schema(self.dataset.schema())
+ def filter(self, expression):
+ """
+ Apply a row filter to the dataset.
+
+ Parameters
+ ----------
+ expression : Expression
+ The filter that should be applied to the dataset.
+
+ Returns
+ -------
+ Dataset
+ """
+ cdef:
+ Dataset filtered_dataset
+
+ new_filter = expression
+ current_filter = self._scan_options.get("filter")
+ if current_filter is not None and new_filter is not None:
+ new_filter = current_filter & new_filter
Review Comment:
If you check that `new_filter is not None`, that means we are covering the
case that `new_filter` would be None, but in that case we have to set
`new_filter = current_filter` ?
--
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]