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 15:27:48 UTC

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

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



##########
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:
       TimestampType and DurationType are both int64_t underneath, is it possible to reuse the existing Exec method? (i.e. does `ArithmeticExecFromOp<ScalarBinary, Add>(Type::INT64)` work here?)




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