pitrou commented on code in PR #36231:
URL: https://github.com/apache/arrow/pull/36231#discussion_r1238391248


##########
cpp/src/arrow/compute/kernels/scalar_arithmetic.cc:
##########
@@ -640,6 +642,17 @@ struct ArithmeticFunction : ScalarFunction {
           ReplaceTypes(type, types);
         }
       }
+
+      if (name_ == "multiply_checked") {
+        // MultiplyChecked requires the same type for both operands, therefore 
we can't
+        // easily make kernels for integers other than int64, so we just cast 
integers to
+        // int64
+        if ((*types)[0].id() == Type::DURATION && 
is_integer((*types)[1].id())) {
+          ReplaceTypes(int64(), &(*types)[1], 1);
+        } else if ((*types)[1].id() == Type::DURATION && 
is_integer((*types)[0].id())) {
+          ReplaceTypes(int64(), &(*types)[0], 1);
+        }
+      }

Review Comment:
   Are there other places where a similar pattern may be desired? Should this 
be factored out somehow?
   cc @lidavidm @bkietz  for opinions.



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

Reply via email to