adriangb commented on code in PR #19854: URL: https://github.com/apache/datafusion/pull/19854#discussion_r2700285852
########## docs/source/library-user-guide/upgrading.md: ########## @@ -118,6 +118,42 @@ let context = SimplifyContext::default() See [`SimplifyContext` documentation](https://docs.rs/datafusion-expr/latest/datafusion_expr/simplify/struct.SimplifyContext.html) for more details. +### `FilterExec` builder methods deprecated + +The following methods on `FilterExec` have been deprecated in favor of using `FilterExecBuilder`: + +- `with_projection()` +- `with_batch_size()` + +**Who is affected:** + +- Users who create `FilterExec` instances and use these methods to configure them + +**Migration guide:** + +Use `FilterExecBuilder` instead of chaining method calls on `FilterExec`: + +**Before:** + +```rust,ignore +let filter = FilterExec::try_new(predicate, input)? + .with_projection(Some(vec![0, 2]))? + .with_batch_size(8192)?; +``` + +**After:** + +```rust,ignore +let filter = FilterExecBuilder::new(predicate, input) + .with_projection(Some(vec![0, 2])) + .with_batch_size(8192) + .build()?; +``` + +The builder pattern is more efficient as it computes properties once during `build()` rather than recomputing them for each method call. + +Note: `with_default_selectivity()` is not deprecated as it simply updates a field value and does not require the overhead of the builder pattern. Review Comment: I simplified the upgrade guide ########## datafusion/physical-plan/src/filter.rs: ########## @@ -139,47 +224,42 @@ impl FilterExec { } /// Return new instance of [FilterExec] with the given projection. + /// + /// # Deprecated + /// Use [`FilterExecBuilder::with_projection`] instead + #[deprecated( + since = "52.0.0", + note = "Use FilterExecBuilder::with_projection instead" + )] pub fn with_projection(&self, projection: Option<Vec<usize>>) -> Result<Self> { - // Check if the projection is valid + // Check if the projection is valid against current output schema can_project(&self.schema(), projection.as_ref())?; Review Comment: Yep moved -- 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]
