jorgecarleitao commented on a change in pull request #8097:
URL: https://github.com/apache/arrow/pull/8097#discussion_r482975446



##########
File path: rust/datafusion/src/execution/context.rs
##########
@@ -417,7 +445,16 @@ impl ExecutionConfig {
         mut self,
         physical_planner: Arc<dyn PhysicalPlanner>,
     ) -> Self {
-        self.physical_planner = Some(physical_planner);
+        self.physical_planner = physical_planner;
+        self
+    }
+
+    /// Optional source of additional optimization passes
+    pub fn with_optimizer_rule_source(

Review comment:
       I like with `Clone` also.
   
   Another idea (not for this PR) is to make `OptimizerRule` be a function 
only, i.e. replace the trait by `Fn(Plan) -> Result<Plan>`. `TypeCoercer` lost 
its state in one of my recent PRs. In the end, the way we have been using this 
trait is:
   
   1. Initialize the optimizer without arguments
   2. Run the optimizer with a single argument (logicalplan)
   3. remove the optimizer
   
   If we really need to offer the optimizer some more information, we could 
just pass the executionContextState as a second argument of `optimize`.
   
   This way, we do not really need to worry about memory management, which we 
really do not need in practice, as optimizations are stateless unless we need 
some introspection as to what it did, in which case logging seems adequate.
   




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to