projjal commented on a change in pull request #9890:
URL: https://github.com/apache/arrow/pull/9890#discussion_r622785567
##########
File path: cpp/src/gandiva/function_registry_datetime.cc
##########
@@ -29,6 +29,10 @@ namespace gandiva {
DATE_TYPES(INNER, name##Hour, {}), DATE_TYPES(INNER, name##Minute, {}),
\
DATE_TYPES(INNER, name##Second, {})
+#define TO_TIME_TIMESTAMP_SAFE_NULL_IF_NULL(NAME, ALIASES, TYPE)
\
+ NativeFunction(#NAME, std::vector<std::string> ALIASES,
DataTypeVector{TYPE()}, \
+ timestamp(), kResultNullIfNull,
ARROW_STRINGIFY(NAME##_##TYPE))
Review comment:
output shoudn't be timestamp() for to_time() function
##########
File path: cpp/src/gandiva/precompiled/time.cc
##########
@@ -828,4 +841,21 @@ gdv_int64 castBIGINT_daytimeinterval(gdv_day_time_interval
in) {
extractDay_daytimeinterval(in) * MILLIS_IN_DAY;
}
+#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 seconds to time, considering the quantity of seconds after midnight
+#define TO_TIME(TYPE) \
+ FORCE_INLINE \
+ gdv_time32 to_time##_##TYPE(gdv_##TYPE seconds) { \
Review comment:
The argument should be seconds since epoch. Same as to_timestamp
##########
File path: cpp/src/gandiva/precompiled/time.cc
##########
@@ -828,4 +841,21 @@ gdv_int64 castBIGINT_daytimeinterval(gdv_day_time_interval
in) {
extractDay_daytimeinterval(in) * MILLIS_IN_DAY;
}
+#define TO_TIMESTAMP(TYPE) \
+ FORCE_INLINE \
+ gdv_timestamp to_timestamp##_##TYPE(gdv_##TYPE seconds) { \
Review comment:
add a comment explaining the argument is seconds from epoch
--
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]