pitrou commented on a change in pull request #12612:
URL: https://github.com/apache/arrow/pull/12612#discussion_r829179079
##########
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:
As a nit, this is the same as `exec1`, so you can just remove the
`std::move` instead of recreating a new one :-)
##########
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:
Here's a thought: how about we define `CheckScalarBinaryCommutative` so
that we can simply replace `CheckScalarBinary` with it in all heterogenous
addition tests?
##########
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:
Same here as well of course (and probably below?).
--
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]