projjal commented on a change in pull request #9890:
URL: https://github.com/apache/arrow/pull/9890#discussion_r623785058



##########
File path: cpp/src/gandiva/precompiled/time.cc
##########
@@ -828,4 +841,22 @@ gdv_int64 castBIGINT_daytimeinterval(gdv_day_time_interval 
in) {
          extractDay_daytimeinterval(in) * MILLIS_IN_DAY;
 }
 
+// Convert the seconds since epoch argument to timestamp
+#define TO_TIMESTAMP(TYPE)                                      \
+  FORCE_INLINE                                                  \
+  gdv_timestamp to_timestamp##_##TYPE(gdv_##TYPE seconds) {     \
+    return static_cast<gdv_timestamp>(seconds) * MILLIS_IN_SEC; \
+  }
+
+NUMERIC_TYPES(TO_TIMESTAMP)
+
+// Convert the seconds since epoch argument to time
+#define TO_TIME(TYPE)                                        \
+  FORCE_INLINE                                               \
+  gdv_time32 to_time##_##TYPE(gdv_##TYPE seconds) {          \
+    return static_cast<gdv_time32>(seconds) * MILLIS_IN_SEC; \

Review comment:
       It should be something like 
   ```
   EpochTimePoint tp(seconds * MILLIS_IN_SEC);
   return tp.TimeOfDay().to_duration().to_millis()
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to