alamb commented on a change in pull request #1319:
URL: https://github.com/apache/arrow-datafusion/pull/1319#discussion_r752660357



##########
File path: datafusion/src/optimizer/constant_folding.rs
##########
@@ -101,7 +105,30 @@ impl OptimizerRule for ConstantFolding {
                             // fold constants and then simplify
                             .rewrite(&mut const_evaluator)?
                             .rewrite(&mut simplifier)?;
-                        Ok(new_e)
+
+                        let new_name = &new_e.name(plan.schema());
+
+                        // Some plans will be candidates in projection 
pushdown rule to
+                        // trim expressions based on expression names. We need 
to keep
+                        // expression name for them.
+                        let is_plan_for_projection_pushdown = matches!(
+                            plan,
+                            LogicalPlan::Window { .. }

Review comment:
       Have you tried following the model in 
https://github.com/apache/arrow-datafusion/pull/1315/files#diff-1d33be1a7e8231e53102eab8112e30aa89d8f5cb8c21cd25bcfbce3050cdb433R110
 ? I think that calls `columnize_expr` among perhaps some other differences. 
   
   Basically I think the code needs to do something like walk over the field 
names in the output `schema` and if they names of the rewritten exprs weren't 
the same add an alias;




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