amol- commented on code in PR #13409: URL: https://github.com/apache/arrow/pull/13409#discussion_r917803202
########## python/pyarrow/_dataset.pyx: ########## @@ -432,6 +447,73 @@ cdef class Dataset(_Weakrefable): use_threads=use_threads, coalesce_keys=coalesce_keys, output_type=InMemoryDataset) +cdef class FilteredDataset(Dataset): + """ + A Dataset with an applied filter. + + Parameters + ---------- + dataset : Dataset + The dataset to which the filter should be applied. + expression : Expression + The filter that should be applied to the dataset. + """ + + def __init__(self, dataset, expression): + self.init(<shared_ptr[CDataset]>(<Dataset>dataset).wrapped) + self._filter = expression + + cdef void init(self, const shared_ptr[CDataset]& sp): + Dataset.init(self, sp) + self._filter = None + + def filter(self, expression): + """Apply an additional row filter to the filtered dataset. + + Parameters + ---------- + expression : Expression + The filter that should be applied to the dataset. + + Returns + ------- + FilteredDataset + """ + cdef: + FilteredDataset filtered_dataset + + if self._filter is not None: Review Comment: That was the original implementation, and I was asked to explicitly move it in a dedicated class. Which I think in the end makes sense, better have a single responsibility per class. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org