alamb commented on code in PR #3574:
URL: https://github.com/apache/arrow-datafusion/pull/3574#discussion_r976732342


##########
datafusion/optimizer/src/type_coercion.rs:
##########
@@ -79,10 +79,29 @@ impl OptimizerRule for TypeCoercion {
             const_evaluator,
         };
 
+        let original_expr_names: Vec<Option<String>> = plan
+            .expressions()
+            .iter()
+            .map(|expr| expr.name().ok())
+            .collect();
+
         let new_expr = plan
             .expressions()
             .into_iter()
-            .map(|expr| expr.rewrite(&mut expr_rewrite))
+            .zip(original_expr_names)
+            .map(|(expr, original_name)| {
+                let expr = expr.rewrite(&mut expr_rewrite)?;
+
+                if matches!(expr, Expr::AggregateFunction { .. }) {

Review Comment:
   ```suggestion
                   // ensure aggregate names don't change:
                   // https://github.com/apache/arrow-datafusion/issues/3555
                   if matches!(expr, Expr::AggregateFunction { .. }) {
   ```



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