peter-toth commented on code in PR #10868: URL: https://github.com/apache/datafusion/pull/10868#discussion_r1635312685
########## datafusion/optimizer/src/common_subexpr_eliminate.rs: ########## @@ -515,14 +522,15 @@ fn build_common_expr_project_plan( let mut fields_set = BTreeSet::new(); let mut project_exprs = common_exprs .into_iter() - .map(|(expr_id, expr)| { + .enumerate() + .map(|(index, (expr_id, expr))| { Review Comment: Yeah, eliminating single columns is no use. I think you need to choose an alias for the extracted expression in `f_down()` of `CommonSubexprRewriter` based on the schema (check that there is no collision) and store the alias in `common_exprs`. ########## datafusion/optimizer/src/common_subexpr_eliminate.rs: ########## @@ -515,14 +522,15 @@ fn build_common_expr_project_plan( let mut fields_set = BTreeSet::new(); let mut project_exprs = common_exprs .into_iter() - .map(|(expr_id, expr)| { + .enumerate() + .map(|(index, (expr_id, expr))| { Review Comment: Yeah, eliminating a single column is no use. I think you need to choose an alias for the extracted expression in `f_down()` of `CommonSubexprRewriter` based on the schema (check that there is no collision) and store the alias in `common_exprs`. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org