palak-9202 commented on code in PR #13428:
URL: https://github.com/apache/arrow/pull/13428#discussion_r919698275


##########
cpp/src/gandiva/gdv_function_stubs.cc:
##########
@@ -611,6 +611,51 @@ int32_t gdv_fn_cast_intervalyear_utf8_int32(int64_t 
context_ptr, int64_t holder_
   auto* holder = reinterpret_cast<gandiva::IntervalYearsHolder*>(holder_ptr);
   return (*holder)(context, data, data_len, in1_validity, out_valid);
 }
+
+GANDIVA_EXPORT
+gdv_timestamp to_utc_timezone_timestamp(int64_t context, gdv_timestamp 
time_miliseconds,
+                                        const char* timezone, gdv_int32 
length) {
+  using std::chrono::milliseconds;
+  using arrow_vendored::date::sys_time;
+  using arrow_vendored::date::time_zone;
+  using arrow_vendored::date::zoned_time;
+  using arrow_vendored::date::locate_zone;
+
+  sys_time <milliseconds> tp {milliseconds{time_miliseconds}};
+  try {
+    const time_zone* local_tz = locate_zone(std::string(timezone, length));
+    gdv_timestamp offset = local_tz->get_info(tp).offset.count()*1000;
+    return time_miliseconds - static_cast<gdv_timestamp>(offset);
+  } catch(...) {
+      gdv_fn_context_set_error_msg(context, "Invalid time zone");
+      return 0;
+  }
+}
+
+GANDIVA_EXPORT
+gdv_timestamp from_utc_timezone_timestamp(gdv_int64 context,
+                                          gdv_timestamp time_miliseconds,
+                                          const char* timezone, gdv_int32 
length) {
+  using std::chrono::milliseconds;
+  using arrow_vendored::date::sys_time;
+  using arrow_vendored::date::time_zone;
+  using arrow_vendored::date::zoned_time;
+  using arrow_vendored::date::make_zoned;
+
+  sys_time <milliseconds> tp {milliseconds{time_miliseconds}};
+  const zoned_time<milliseconds, const time_zone*> utc_tz =

Review Comment:
   I didn't get any errors on my environment either, the build error occurred 
in the Appveyor build check



-- 
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-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to