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/02/09 20:11:42 UTC

[GitHub] [arrow] rok commented on a change in pull request #12378: ARROW-14094: [C++] add(timestamp, duration) -> timestamp kernel

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



##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -2536,12 +2536,31 @@ void RegisterScalarArithmetic(FunctionRegistry* registry) {
   // ----------------------------------------------------------------------
   auto add = MakeArithmeticFunction<Add>("add", &add_doc);
   AddDecimalBinaryKernels<Add>("add", add.get());
+
+  // Add add(timestamp, duration) -> timestamp
+  for (auto unit : TimeUnit::values()) {
+    InputType in_type(match::TimestampTypeUnit(unit));
+    auto exec = ScalarBinary<TimestampType, DurationType, TimestampType, Add>::Exec;

Review comment:
       It works for `ScalarBinaryEqualTypes` but not for `ScalarBinary` as it takes in and out types.
   `auto exec = ArithmeticExecFromOp<ScalarBinaryEqualTypes, Add>(Type:: INT64);` would work.
   
   We could add `ArithmeticExecFromOpEqualTypes`.




-- 
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