kosiew commented on code in PR #19674:
URL: https://github.com/apache/datafusion/pull/19674#discussion_r2700582798


##########
datafusion/physical-expr/src/expressions/cast.rs:
##########
@@ -237,6 +237,11 @@ pub fn cast_with_options(
         Ok(Arc::clone(&expr))
     } else if can_cast_types(&expr_type, &cast_type) {
         Ok(Arc::new(CastExpr::new(expr, cast_type, cast_options)))
+    } else if matches!((&expr_type, &cast_type), (Struct(_), Struct(_))) {
+        // Allow struct-to-struct casts even if Arrow's can_cast_types rejects 
them
+        // (e.g., field count mismatches). These will be handled by name-based 
casting
+        // at execution time via ColumnarValue::cast_to

Review Comment:
   Amended.



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