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 2021/08/10 00:40:43 UTC

[GitHub] [arrow] jvictorhuguenin commented on a change in pull request #10425: ARROW-12910: [Gandiva][C++]Add support for ADD and SUBTRACT functions receiving time intervals

jvictorhuguenin commented on a change in pull request #10425:
URL: https://github.com/apache/arrow/pull/10425#discussion_r685610874



##########
File path: cpp/src/gandiva/precompiled/timestamp_arithmetic.cc
##########
@@ -172,6 +172,57 @@ TIMESTAMP_DIFF(timestamp)
     return millis + TO_MILLIS * static_cast<gdv_##TYPE>(count);          \
   }
 
+#define ADD_DAY_TIME_INTERVAL_TO_TIMESTAMP(TYPE, NAME, TO_MILLIS)              \
+  FORCE_INLINE                                                                 \
+  gdv_timestamp NAME##_day_time_interval_##TYPE(gdv_##TYPE millis,             \
+                                                gdv_day_time_interval count) { \
+    gdv_int64 day_interval_days = extractDay_daytimeinterval(count);           \
+    gdv_int64 day_interval_millis = extractMillis_daytimeinterval(count);      \
+    return static_cast<gdv_timestamp>(millis) +                                \
+           (day_interval_days * TO_MILLIS + day_interval_millis);              \
+  }
+
+#define SUB_DAY_TIME_INTERVAL_TO_TIMESTAMP(TYPE, NAME, TO_MILLIS)              \
+  FORCE_INLINE                                                                 \
+  gdv_timestamp NAME##_day_time_interval_##TYPE(gdv_##TYPE millis,             \
+                                                gdv_day_time_interval count) { \
+    gdv_int64 day_interval_days = extractDay_daytimeinterval(count);           \
+    gdv_int64 day_interval_millis = extractMillis_daytimeinterval(count);      \
+    return static_cast<gdv_timestamp>(millis) -                                \
+           (day_interval_days * TO_MILLIS + day_interval_millis);              \
+  }

Review comment:
       you are right, I'm sorry




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