adriangb commented on code in PR #19854:
URL: https://github.com/apache/datafusion/pull/19854#discussion_r2700286560
##########
datafusion/physical-plan/src/filter.rs:
##########
@@ -92,39 +92,124 @@ pub struct FilterExec {
fetch: Option<usize>,
}
+/// Builder for [`FilterExec`] to set optional parameters
+pub struct FilterExecBuilder {
+ predicate: Arc<dyn PhysicalExpr>,
+ input: Arc<dyn ExecutionPlan>,
+ projection: Option<Vec<usize>>,
+ default_selectivity: u8,
+ batch_size: usize,
+ fetch: Option<usize>,
+}
+
+impl FilterExecBuilder {
+ /// Create a new builder with required parameters (predicate and input)
+ pub fn new(predicate: Arc<dyn PhysicalExpr>, input: Arc<dyn
ExecutionPlan>) -> Self {
+ Self {
+ predicate,
+ input,
+ projection: None,
+ default_selectivity: FILTER_EXEC_DEFAULT_SELECTIVITY,
+ batch_size: FILTER_EXEC_DEFAULT_BATCH_SIZE,
+ fetch: None,
+ }
+ }
+
+ /// Set the projection, composing with any existing projection.
+ ///
+ /// If a projection is already set, the new projection indices are mapped
+ /// through the existing projection. For example, if the current projection
+ /// is `[0, 2, 3]` and `with_projection(Some(vec![0, 2]))` is called, the
+ /// resulting projection will be `[0, 3]` (indices 0 and 2 of `[0, 2, 3]`).
+ ///
+ /// If no projection is currently set, the new projection is used directly.
+ /// If `None` is passed, the projection is cleared.
+ pub fn with_projection(mut self, projection: Option<Vec<usize>>) -> Self {
Review Comment:
Good call, renamed!
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]