You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/01/28 17:18:30 UTC

[GitHub] [arrow] rok commented on a change in pull request #12139: ARROW-14097: [C++] subtract(time, duration) -> time kernel

rok commented on a change in pull request #12139:
URL: https://github.com/apache/arrow/pull/12139#discussion_r794702370



##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -2437,6 +2458,30 @@ void RegisterScalarArithmetic(FunctionRegistry* registry) {
                                   std::move(exec)));
   }
 
+  // Add subtract(duration, duration) -> duration
+  for (auto unit : TimeUnit::values()) {
+    InputType in_type(match::DurationTypeUnit(unit));
+    auto exec = ArithmeticExecFromOp<ScalarBinaryEqualTypes, Subtract>(Type::DURATION);
+    DCHECK_OK(subtract->AddKernel({in_type, in_type}, duration(unit), std::move(exec)));
+  }
+
+  // Add subtract(time32, duration) -> duration

Review comment:
       Yeah switching to `subtract(time32/64, duration) -> time32/64`. I suppose validation should a be part of the subtract kernel then.




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org