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 a79f9c889 minor: fix rule name and comment. (#5370)
a79f9c889 is described below

commit a79f9c889c29a736e727dcb29ede1c2d25618a70
Author: jakevin <[email protected]>
AuthorDate: Thu Feb 23 19:29:18 2023 +0800

    minor: fix rule name and comment. (#5370)
---
 datafusion/optimizer/src/merge_projection.rs | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/datafusion/optimizer/src/merge_projection.rs 
b/datafusion/optimizer/src/merge_projection.rs
index f3a4ba334..d55128301 100644
--- a/datafusion/optimizer/src/merge_projection.rs
+++ b/datafusion/optimizer/src/merge_projection.rs
@@ -82,7 +82,7 @@ impl OptimizerRule for MergeProjection {
     }
 
     fn name(&self) -> &str {
-        "eliminate_filter"
+        "merge_projection"
     }
 
     fn apply_order(&self) -> Option<ApplyOrder> {
@@ -97,12 +97,8 @@ pub fn collect_projection_expr(projection: &Projection) -> 
HashMap<String, Expr>
         .iter()
         .enumerate()
         .flat_map(|(i, field)| {
-            // strip alias, as they should not be part of filters
-            let expr = match &projection.expr[i] {
-                Expr::Alias(expr, _) => expr.as_ref().clone(),
-                expr => expr.clone(),
-            };
-
+            // strip alias
+            let expr = projection.expr[i].clone().unalias();
             // Convert both qualified and unqualified fields
             [
                 (field.name().clone(), expr.clone()),

Reply via email to