Col-Waltz commented on code in PR #16066: URL: https://github.com/apache/datafusion/pull/16066#discussion_r2093603729
########## datafusion/optimizer/src/common_subexpr_eliminate.rs: ########## @@ -316,6 +316,19 @@ impl CommonSubexprEliminate { } => { let rewritten_aggr_expr = new_exprs_list.pop().unwrap(); let new_aggr_expr = original_exprs_list.pop().unwrap(); + let saved_names = if let Some(aggr_expr) = aggr_expr { + let name_preserver = NamePreserver::new_for_projection(); + aggr_expr + .iter() + .map(|expr| Some(name_preserver.save(expr))) + .collect::<Vec<_>>() + } else { + new_aggr_expr Review Comment: Yes it is, thanks for the comment. But this will not work, because vec! requires value to implement Clone trait but the Option<SavedName> doesnt. It seems to me easier to do this by map. -- 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