adamreeve commented on code in PR #55665:
URL: https://github.com/apache/arrow/pull/55665#discussion_r4609278053
##########
cpp/src/arrow/dataset/dataset.h:
##########
@@ -485,6 +485,67 @@ class ARROW_DS_EXPORT UnionDataset : public Dataset {
friend class UnionDatasetFactory;
};
+/// \brief A Fragment which wraps another Fragment and applies a filter.
+class ARROW_DS_EXPORT FilteredFragment : public Fragment {
+ public:
+ FilteredFragment(std::shared_ptr<Fragment> fragment, compute::Expression
filter);
+
+ Result<RecordBatchGenerator> ScanBatchesAsync(
+ const std::shared_ptr<ScanOptions>& options) override;
+
+ Future<std::optional<int64_t>> CountRows(
+ compute::Expression predicate,
+ const std::shared_ptr<ScanOptions>& options) override;
+
+ Status ClearCachedMetadata() override;
+
+ std::string type_name() const override { return "filtered"; }
+
+ std::string ToString() const override;
+
+ const std::shared_ptr<Fragment>& fragment() const { return fragment_; }
+
+ const compute::Expression& filter() const { return filter_; }
+
+ protected:
+ Result<std::shared_ptr<Schema>> ReadPhysicalSchemaImpl() override;
+
+ std::shared_ptr<Fragment> fragment_;
+ compute::Expression filter_;
+};
+
+/// \brief A Dataset which wraps another Dataset and applies a filter.
+///
+/// Unlike a filter in ScanOptions, the filter is part of the Dataset itself,
so it
+/// is preserved when the Dataset is combined with others, e.g. as a child of a
+/// UnionDataset whose other children have different filters.
+class ARROW_DS_EXPORT FilteredDataset : public Dataset {
Review Comment:
Added in 9bcd294d8238c8e824abafc4b331aabb728de44f
--
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]