pitrou commented on code in PR #50870:
URL: https://github.com/apache/arrow/pull/50870#discussion_r3902239522
##########
cpp/src/arrow/compute/kernels/scalar_if_else_test.cc:
##########
@@ -3693,8 +3693,22 @@ TEST(TestCoalesce, DispatchBest) {
CheckDispatchBest("coalesce", {int32(), decimal128(3, 2)},
{decimal128(12, 2), decimal128(12, 2)});
CheckDispatchBest("coalesce", {float32(), decimal128(3, 2)}, {float64(),
float64()});
+ CheckDispatchBest("coalesce", {decimal128(3, 2), decimal128(4, 2)},
+ {decimal128(4, 2), decimal128(4, 2)});
+ CheckDispatchBest("coalesce", {decimal128(4, 2), decimal128(3, 2)},
+ {decimal128(4, 2), decimal128(4, 2)});
+ CheckDispatchBest("coalesce", {decimal128(4, 1), decimal128(3, 2)},
+ {decimal128(5, 2), decimal128(5, 2)});
+ CheckDispatchBest("coalesce", {decimal128(3, 2), decimal128(4, 1)},
+ {decimal128(5, 2), decimal128(5, 2)});
+ CheckDispatchBest("coalesce", {decimal128(3, 2), decimal128(4, 3)},
+ {decimal128(4, 3), decimal128(4, 3)});
+ CheckDispatchBest("coalesce", {decimal128(4, 3), decimal128(3, 2)},
+ {decimal128(4, 3), decimal128(4, 3)});
CheckDispatchBest("coalesce", {decimal128(3, 2), decimal256(3, 2)},
{decimal256(3, 2), decimal256(3, 2)});
+ CheckDispatchBest("coalesce", {decimal256(3, 2), decimal128(3, 2)},
Review Comment:
What about e.g. `{decimal256(4, 1), decimal128(3, 2)}`?
##########
cpp/src/arrow/compute/kernels/scalar_if_else.cc:
##########
@@ -2035,6 +2035,20 @@ struct CoalesceFunction : ScalarFunction {
if (auto kernel = DispatchExactImpl(this, *types)) return kernel;
return arrow::compute::detail::NoMatchingKernel(this, *types);
}
+
+ static std::shared_ptr<MatchConstraint> DecimalMatchConstraint() {
Review Comment:
It would be surprising if `if_else` was the only kernel to use this
constraint, should it be exposed in `kernel.h`? I see there's already
`DecimalsHaveSameScale` there.
--
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]