zanmato1984 commented on code in PR #47297:
URL: https://github.com/apache/arrow/pull/47297#discussion_r2285023001


##########
cpp/src/arrow/compute/kernels/scalar_arithmetic.cc:
##########
@@ -669,13 +669,16 @@ void AddDecimalUnaryKernels(ScalarFunction* func) {
 template <typename Op>
 void AddDecimalBinaryKernels(const std::string& name, ScalarFunction* func) {
   OutputType out_type(null());
+  std::shared_ptr<MatchConstraint> constraint = nullptr;
   const std::string op = name.substr(0, name.find("_"));
   if (op == "add" || op == "subtract") {
     out_type = OutputType(ResolveDecimalAdditionOrSubtractionOutput);
+    constraint = DecimalsHaveSameScale();
   } else if (op == "multiply") {
     out_type = OutputType(ResolveDecimalMultiplicationOutput);
   } else if (op == "divide") {
     out_type = OutputType(ResolveDecimalDivisionOutput);
+    constraint = BinaryDecimalScaleComparisonGE();

Review Comment:
   Good point. Yes that's possible, as we are now suppressing the match for 
decimal arguments not qualifying the constraints. The explicit error returning 
could be a simple `DCHECK` now.



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