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/03/24 23:03:11 UTC

[GitHub] [arrow] jonkeane commented on a change in pull request #12536: ARROW-13168: [C++][R] Enable runtime timezone database for Windows

jonkeane commented on a change in pull request #12536:
URL: https://github.com/apache/arrow/pull/12536#discussion_r834801280



##########
File path: cpp/src/arrow/config.cc
##########
@@ -73,7 +76,32 @@ RuntimeInfo GetRuntimeInfo() {
       MakeSimdLevelString([&](int64_t flags) { return cpu_info->IsSupported(flags); });
   info.detected_simd_level =
       MakeSimdLevelString([&](int64_t flags) { return cpu_info->IsDetected(flags); });
+  info.using_os_timezone_db = USE_OS_TZDB;
+#if !USE_OS_TZDB
+  info.timezone_db_path = timezone_db_path;
+#else
+  info.timezone_db_path = util::optional<std::string>();
+#endif
   return info;
 }
 
+Status Initialize(const GlobalOptions& options) noexcept {
+  if (options.timezone_db_path.has_value()) {
+#if !USE_OS_TZDB
+    try {
+      arrow_vendored::date::set_install(options.timezone_db_path.value());
+      arrow_vendored::date::reload_tzdb();
+    } catch (const std::runtime_error& e) {
+      return Status::IOError(e.what());
+    }
+    timezone_db_path = options.timezone_db_path.value();
+#else
+    return Status::Invalid(
+        "Arrow was set to use OS timezone database at compile time, so a downloaded database "
+        "cannot be provided at runtime.");

Review comment:
       ```suggestion
       return Status::Invalid(
           "Arrow was set to use OS timezone database at compile time, "
           "so a downloaded database cannot be provided at runtime.");
   ```
   
   to appease the linter

##########
File path: r/src/config.cpp
##########
@@ -34,4 +35,16 @@ std::vector<std::string> runtime_info() {
   return {info.simd_level, info.detected_simd_level};
 }
 
+// [[arrow::export]]
+void set_timezone_database(cpp11::strings path) {
+  auto paths = cpp11::as_cpp<std::vector<std::string>>(path);
+  if (path.size() != 1) {
+    cpp11::stop("Must provide a single path to the timezone database.");
+  }
+
+  arrow::ArrowGlobalOptions options;

Review comment:
       ```suggestion
     arrow::GlobalOptions options;
   ```
   
   Just looking at the CI failures, and I think this is a typo?




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