cetra3 commented on code in PR #20426:
URL: https://github.com/apache/datafusion/pull/20426#discussion_r2892288270
##########
datafusion/expr-common/src/type_coercion/binary.rs:
##########
@@ -859,11 +886,15 @@ pub fn try_type_union_resolution_with_struct(
///
/// # Numeric / String comparisons
///
-/// When comparing numeric values and strings, both values will be coerced to
-/// strings. For example when comparing `'2' > 1`, the arguments will be
-/// coerced to `Utf8` for comparison
+/// When comparing numeric values and strings, the string value will be coerced
+/// to the numeric type. For example when comparing `'2' > 1` where `1` is
+/// `Int32`, `'2'` will be coerced to `Int32` for comparison.
+///
+/// For type unification contexts (see [`type_union_coercion`]), use
+/// [`type_union_coercion`] instead, which prefers strings as the safe widening
+/// type.
pub fn comparison_coercion(lhs_type: &DataType, rhs_type: &DataType) ->
Option<DataType> {
- if lhs_type.equals_datatype(rhs_type) {
+ if lhs_type == rhs_type {
Review Comment:
Is there a reason for this change? Shouldn't we prefer `equals_datatype` here
--
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]