rok commented on a change in pull request #12105:
URL: https://github.com/apache/arrow/pull/12105#discussion_r786886697
##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -2428,6 +2435,20 @@ void RegisterScalarArithmetic(FunctionRegistry*
registry) {
DCHECK_OK(subtract->AddKernel({in_type, in_type}, duration(unit),
std::move(exec)));
}
+ // Add subtract(time32, time32) -> duration
+ for (auto unit : {TimeUnit::SECOND, TimeUnit::MILLI}) {
+ InputType in_type(match::Time32TypeUnit(unit));
+ auto exec = ScalarBinaryEqualTypes<Int64Type, Time32Type,
SubtractTime32>::Exec;
Review comment:
Because `Subtract` call we go through asserts Arg0 and Arg1 to be equal
to T:
```
template <typename T, typename Arg0, typename Arg1>
static constexpr enable_if_signed_integer_value<T> Call(KernelContext*,
Arg0 left,
Arg1 right,
Status*) {
static_assert(std::is_same<T, Arg0>::value && std::is_same<T,
Arg1>::value, "");
return arrow::internal::SafeSignedSubtract(left, right);
}
```
Similar holds for date32. We could make `enable_if_signed_integer_value`
accept Arg0 and T and make `enable_if_heterogeneous_signed_integer_value` to
cover casting cases.
--
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]