rok commented on a change in pull request #12612:
URL: https://github.com/apache/arrow/pull/12612#discussion_r829012588
##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -240,11 +240,11 @@ struct SubtractCheckedDate32 {
}
};
-template <bool is_32bit, int64_t multiple>
+template <bool left_is_32bit, int64_t multiple>
struct AddTimeDuration {
template <typename T, typename Arg0, typename Arg1>
- static enable_if_t<is_32bit, T> Call(KernelContext*, Arg0 left, Arg1 right,
- Status* st) {
+ static enable_if_t<(!std::is_same<Arg0, Arg1>::value && left_is_32bit), T>
Call(
+ KernelContext*, Arg0 left, Arg1 right, Status* st) {
T result = arrow::internal::SafeSignedAdd(left, static_cast<T>(right));
Review comment:
Done.
##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -2637,9 +2609,12 @@ void RegisterScalarArithmetic(FunctionRegistry*
registry) {
// Add add(timestamp, duration) -> timestamp
for (auto unit : TimeUnit::values()) {
InputType in_type(match::TimestampTypeUnit(unit));
- auto exec = ScalarBinary<Int64Type, Int64Type, Int64Type, Add>::Exec;
+ auto exec1 = ScalarBinary<Int64Type, Int64Type, Int64Type, Add>::Exec;
DCHECK_OK(add->AddKernel({in_type, duration(unit)}, OutputType(FirstType),
- std::move(exec)));
+ std::move(exec1)));
+ auto exec2 = ScalarBinary<Int64Type, Int64Type, Int64Type, Add>::Exec;
Review comment:
Done.
##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -2661,9 +2637,12 @@ void RegisterScalarArithmetic(FunctionRegistry*
registry) {
// Add add_checked(timestamp, duration) -> timestamp
for (auto unit : TimeUnit::values()) {
InputType in_type(match::TimestampTypeUnit(unit));
- auto exec = ScalarBinary<Int64Type, Int64Type, Int64Type,
AddChecked>::Exec;
+ auto exec1 = ScalarBinary<Int64Type, Int64Type, Int64Type,
AddChecked>::Exec;
DCHECK_OK(add_checked->AddKernel({in_type, duration(unit)},
OutputType(FirstType),
- std::move(exec)));
+ std::move(exec1)));
+ auto exec2 = ScalarBinary<Int64Type, Int64Type, Int64Type,
AddChecked>::Exec;
Review comment:
Done.
##########
File path: cpp/src/arrow/compute/kernels/scalar_temporal_test.cc
##########
@@ -1070,6 +1070,9 @@ TEST_F(ScalarTemporalTest,
TestTemporalAddDateAndDuration) {
ArrayFromJSON(timestamp(TimeUnit::MICRO), times_seconds_precision);
CheckScalarBinary(op, dates32, durations_us, timestamps_us);
CheckScalarBinary(op, dates64, durations_us, timestamps_us);
+
+ CheckScalarBinary(op, durations_us, dates32, timestamps_us);
+ CheckScalarBinary(op, durations_us, dates64, timestamps_us);
Review comment:
Nice! Done.
--
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]