You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/09/20 17:50:16 UTC

[GitHub] [arrow-datafusion] kmitchener commented on a diff in pull request #3549: fix coercion of null for decimal math in binary_rules

kmitchener commented on code in PR #3549:
URL: https://github.com/apache/arrow-datafusion/pull/3549#discussion_r975657059


##########
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:
   this is the actual fix, the rest is some refactoring



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org