alamb commented on code in PR #14888: URL: https://github.com/apache/datafusion/pull/14888#discussion_r1972400092
########## datafusion/optimizer/src/simplify_expressions/simplify_exprs.rs: ########## @@ -122,14 +123,21 @@ impl SimplifyExpressions { // Preserve expression names to avoid changing the schema of the plan. let name_preserver = NamePreserver::new(&plan); - plan.map_expressions(|e| { - let original_name = name_preserver.save(&e); - let new_e = simplifier - .simplify(e) - .map(|expr| original_name.restore(expr))?; + let mut rewrite_expr = |expr: Expr| { + let name = name_preserver.save(&expr); + let expr = simplifier.simplify(expr)?; // TODO it would be nice to have a way to know if the expression was simplified // or not. For now conservatively return Transformed::yes - Ok(Transformed::yes(new_e)) + Ok(Transformed::yes(name.restore(expr))) + }; + + plan.map_expressions(|expr| { + // Preserve the aliasing of grouping sets. Review Comment: no need to reword if I am the only one confused :) -- 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