neilconway commented on code in PR #20426:
URL: https://github.com/apache/datafusion/pull/20426#discussion_r2994892779


##########
datafusion/expr-common/src/type_coercion/binary.rs:
##########
@@ -748,7 +747,7 @@ fn type_union_resolution_coercion(
                 .or_else(|| list_coercion(lhs_type, rhs_type))
                 .or_else(|| temporal_coercion_nonstrict_timezone(lhs_type, 
rhs_type))
                 .or_else(|| string_coercion(lhs_type, rhs_type))
-                .or_else(|| numeric_string_coercion(lhs_type, rhs_type))
+                .or_else(|| string_numeric_coercion(lhs_type, rhs_type))

Review Comment:
   This is a good and subtle point that should be called out. The previous 
behavior actually already implemented numeric-preferring coercion in this case: 
this applied to situations like `VALUES` lists, array literals, or `COALESCE` 
expressions. So the prior behavior was not super consistent -- we implemented 
type-union-like behavior in some "type union-y" situations but not in others. 
Arguably, it would be more self-consistent to change this situation to be 
string-preferring, for consistency with the rest of this PR, but I think there 
are two good reasons not to do so:
   
    1. Further change to query behavior
    2. I'd like to see us eventually move toward stricter typing behavior, not 
looser, and this would be a step in the wrong direction that IMO we would 
eventually want to revert anyway, which would mean another breaking change.



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