kmitchener commented on code in PR #3549:
URL: https://github.com/apache/arrow-datafusion/pull/3549#discussion_r976925414
##########
datafusion/expr/src/binary_rule.rs:
##########
@@ -308,25 +308,18 @@ fn mathematics_numerical_coercion(
(Decimal128(_, _), Decimal128(_, _)) => {
coercion_decimal_mathematics_type(mathematics_op, lhs_type,
rhs_type)
}
- (Decimal128(_, _), _) => {
- let converted_decimal_type =
coerce_numeric_type_to_decimal(rhs_type);
- match converted_decimal_type {
- None => None,
- Some(right_decimal_type) => coercion_decimal_mathematics_type(
- mathematics_op,
- lhs_type,
- &right_decimal_type,
- ),
- }
+ (Null, dec_type @ Decimal128(_, _)) | (dec_type @ Decimal128(_, _),
Null) => {
+ Some(dec_type.clone())
Review Comment:
Yes, it's basically to shortcut that next match arm for figuring out the
Decimal's precision and scale, which depends on the datatype being math'd to
the decimal ... none of that matters if it's a null, you just need to return
the same datatype. Back further up the chain, the null gets cast to this
datatype.
The other number types don't have the rules that Decimals do, so you'll see
in the same match they just return their own datatype, no complexity.
--
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]