This is an automated email from the ASF dual-hosted git repository.

jakevin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 55ad36a02 Minor: Reduce clones in AnalyzerRule (#5728)
55ad36a02 is described below

commit 55ad36a0241ff3946abb7680d35aff3aafa12fde
Author: Andrew Lamb <[email protected]>
AuthorDate: Mon Mar 27 16:21:19 2023 +0200

    Minor: Reduce clones in AnalyzerRule (#5728)
---
 datafusion/optimizer/src/analyzer/count_wildcard_rule.rs | 4 ++--
 datafusion/optimizer/src/analyzer/inline_table_scan.rs   | 4 ++--
 datafusion/optimizer/src/analyzer/mod.rs                 | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/datafusion/optimizer/src/analyzer/count_wildcard_rule.rs 
b/datafusion/optimizer/src/analyzer/count_wildcard_rule.rs
index e0915d830..ba19108ce 100644
--- a/datafusion/optimizer/src/analyzer/count_wildcard_rule.rs
+++ b/datafusion/optimizer/src/analyzer/count_wildcard_rule.rs
@@ -35,8 +35,8 @@ impl CountWildcardRule {
 }
 
 impl AnalyzerRule for CountWildcardRule {
-    fn analyze(&self, plan: &LogicalPlan, _: &ConfigOptions) -> 
Result<LogicalPlan> {
-        plan.clone().transform_down(&analyze_internal)
+    fn analyze(&self, plan: LogicalPlan, _: &ConfigOptions) -> 
Result<LogicalPlan> {
+        plan.transform_down(&analyze_internal)
     }
 
     fn name(&self) -> &str {
diff --git a/datafusion/optimizer/src/analyzer/inline_table_scan.rs 
b/datafusion/optimizer/src/analyzer/inline_table_scan.rs
index 24ce7bde7..550d095f3 100644
--- a/datafusion/optimizer/src/analyzer/inline_table_scan.rs
+++ b/datafusion/optimizer/src/analyzer/inline_table_scan.rs
@@ -39,8 +39,8 @@ impl InlineTableScan {
 }
 
 impl AnalyzerRule for InlineTableScan {
-    fn analyze(&self, plan: &LogicalPlan, _: &ConfigOptions) -> 
Result<LogicalPlan> {
-        plan.clone().transform_up(&analyze_internal)
+    fn analyze(&self, plan: LogicalPlan, _: &ConfigOptions) -> 
Result<LogicalPlan> {
+        plan.transform_up(&analyze_internal)
     }
 
     fn name(&self) -> &str {
diff --git a/datafusion/optimizer/src/analyzer/mod.rs 
b/datafusion/optimizer/src/analyzer/mod.rs
index 3eb7946cf..aef46926f 100644
--- a/datafusion/optimizer/src/analyzer/mod.rs
+++ b/datafusion/optimizer/src/analyzer/mod.rs
@@ -42,7 +42,7 @@ use std::time::Instant;
 /// it the same result in some more optimal way.
 pub trait AnalyzerRule {
     /// Rewrite `plan`
-    fn analyze(&self, plan: &LogicalPlan, config: &ConfigOptions) -> 
Result<LogicalPlan>;
+    fn analyze(&self, plan: LogicalPlan, config: &ConfigOptions) -> 
Result<LogicalPlan>;
 
     /// A human readable name for this analyzer rule
     fn name(&self) -> &str;
@@ -87,7 +87,7 @@ impl Analyzer {
 
         // TODO add common rule executor for Analyzer and Optimizer
         for rule in &self.rules {
-            new_plan = rule.analyze(&new_plan, config)?;
+            new_plan = rule.analyze(new_plan, config)?;
         }
         check_plan(&new_plan)?;
         log_plan("Final analyzed plan", &new_plan);

Reply via email to