nuno-faria commented on code in PR #20146:
URL: https://github.com/apache/datafusion/pull/20146#discussion_r2767723055


##########
datafusion/expr/src/expr_rewriter/mod.rs:
##########
@@ -261,9 +261,14 @@ fn coerce_exprs_for_schema(
                     #[expect(deprecated)]
                     Expr::Wildcard { .. } => Ok(expr),
                     _ => {
-                        // maintain the original name when casting
-                        let name = dst_schema.field(idx).name();
-                        Ok(expr.cast_to(new_type, src_schema)?.alias(name))
+                        match expr {
+                            // maintain the original name when casting a column
+                            Expr::Column(ref column) => {

Review Comment:
   Added.



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