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


##########
cpp/src/arrow/compute/kernels/scalar_if_else.cc:
##########
@@ -1451,6 +1451,23 @@ struct CaseWhenFunction : ScalarFunction {
     if (auto kernel = DispatchExactImpl(this, *types)) return kernel;
     return arrow::compute::detail::NoMatchingKernel(this, *types);
   }
+
+  static std::shared_ptr<MatchConstraint> DecimalMatchConstraint() {
+    static auto constraint =
+        MatchConstraint::Make([](const std::vector<TypeHolder>& types) -> bool 
{
+          DCHECK_GE(types.size(), 2);
+          DCHECK(std::all_of(types.begin() + 1, types.end(), [](const 
TypeHolder& type) {
+            return is_decimal(type.id());
+          }));
+          const auto& ty1 = checked_cast<const DecimalType&>(*types[1].type);

Review Comment:
   Oh, good catch! I was casting then comparing precisions and scales. Then I 
found the `Equals()` method should work and forgot to remove the cast. Updated 
to use `TypeHolder`'s `operator ==`. Thanks. 



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to