peter-toth commented on code in PR #10868:
URL: https://github.com/apache/datafusion/pull/10868#discussion_r1638078971


##########
datafusion/optimizer/src/common_subexpr_eliminate.rs:
##########
@@ -166,6 +166,15 @@ impl CommonSubexprEliminate {
     ) -> Result<(Vec<Vec<Expr>>, LogicalPlan)> {
         let mut common_exprs = IndexMap::new();
 
+        input.schema().iter().for_each(|(qualifier, field)| {

Review Comment:
   Now this starts to look as the suggested because we assign the unique 
aliases in `CommonSubexprRewriter` and store it in `common_exprs` together with 
the common expression.
   
   But why do you still inject previous `#` aliases to `common_exprs`? I think 
you just need to find the biggest one here and pass that number to 
`CommonSubexprRewriter` and simply start assigning new `#` aliases in 
`f_down()` from that number + 1.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to