lidavidm commented on a change in pull request #12124:
URL: https://github.com/apache/arrow/pull/12124#discussion_r795762911
##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -2437,14 +2462,35 @@ void RegisterScalarArithmetic(FunctionRegistry*
registry) {
std::move(exec)));
}
+ // Add subtract(date32, date32) -> duration(TimeUnit::SECOND)
+ InputType in_type_date_32(date32());
+ auto exec_date_32 = ScalarBinaryEqualTypes<Int64Type, Date32Type,
SubtractDate32>::Exec;
+ DCHECK_OK(subtract->AddKernel({in_type_date_32, in_type_date_32},
+ duration(TimeUnit::SECOND),
std::move(exec_date_32)));
+
+ // Add subtract(date64, date64) -> duration(TimeUnit::MILLI)
+ InputType in_type_date_64(date64());
+ auto exec_date_64 = ScalarBinaryEqualTypes<Int64Type, Date64Type,
Subtract>::Exec;
+ DCHECK_OK(subtract->AddKernel({in_type_date_64, in_type_date_64},
+ duration(TimeUnit::MILLI),
std::move(exec_date_64)));
+
DCHECK_OK(registry->AddFunction(std::move(subtract)));
// ----------------------------------------------------------------------
auto subtract_checked = MakeArithmeticFunctionNotNull<SubtractChecked>(
"subtract_checked", &sub_checked_doc);
AddDecimalBinaryKernels<SubtractChecked>("subtract_checked",
subtract_checked.get());
- // Add subtract(timestamp, duration) -> timestamp
+ // Add subtract_checked(timestamp, timestamp) -> duration
+ for (auto unit : TimeUnit::values()) {
+ InputType in_type(match::TimestampTypeUnit(unit));
Review comment:
Hmm, probably the first timezone, or maybe UTC; since this is a
metadata-only cast, I don't think it's a big difference.
--
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]