AdamGS commented on code in PR #17808:
URL: https://github.com/apache/datafusion/pull/17808#discussion_r2387477540


##########
datafusion/expr-common/src/type_coercion/binary.rs:
##########
@@ -357,6 +357,14 @@ fn math_decimal_coercion(
         | (Decimal256(_, _), Decimal256(_, _)) => {
             Some((lhs_type.clone(), rhs_type.clone()))
         }
+        // Cross-variant decimal coercion - choose larger variant with 
appropriate precision/scale
+        (Decimal32(_, _), Decimal64(_, _) | Decimal128(_, _) | Decimal256(_, 
_))
+        | (Decimal64(_, _), Decimal32(_, _) | Decimal128(_, _) | Decimal256(_, 
_))
+        | (Decimal128(_, _), Decimal32(_, _) | Decimal64(_, _) | Decimal256(_, 
_))
+        | (Decimal256(_, _), Decimal32(_, _) | Decimal64(_, _) | Decimal128(_, 
_)) => {
+            let coerced_type = get_wider_decimal_type_cross_variant(lhs_type, 
rhs_type)?;
+            Some((coerced_type.clone(), coerced_type))
+        }

Review Comment:
   I like it, if arrow ever introduces Decmial8 or whatever, it will minimize 
the break here and its much more readable IMO.



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