andygrove commented on code in PR #2616:
URL: https://github.com/apache/arrow-datafusion/pull/2616#discussion_r881820075


##########
datafusion/core/src/optimizer/optimizer.rs:
##########
@@ -35,3 +39,42 @@ pub trait OptimizerRule {
     /// A human readable name for this optimizer rule
     fn name(&self) -> &str;
 }
+
+/// A rule-based optimizer.
+#[derive(Clone)]
+pub struct Optimizer {
+    /// All rules to apply
+    pub rules: Vec<Arc<dyn OptimizerRule + Send + Sync>>,
+}
+
+impl Optimizer {
+    /// Create a new optimizer with the given rules
+    pub fn new(rules: Vec<Arc<dyn OptimizerRule + Send + Sync>>) -> Self {
+        Self { rules }
+    }
+
+    /// Optimizes the logical plan by applying optimizer rules, and
+    /// invoking observer function after each call
+    pub fn optimize<F>(
+        &self,
+        plan: &LogicalPlan,
+        execution_props: &mut ExecutionProps,

Review Comment:
   Not related to your changes but I  am trying to get rid of the use of 
`ExecutionProps` here - https://github.com/apache/arrow-datafusion/issues/2614



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

Reply via email to