efegokdemir commented on code in PR #4878:
URL: https://github.com/apache/arrow-adbc/pull/4878#discussion_r4245777241


##########
c/driver/sqlite/sqlite_test.cc:
##########
@@ -1087,6 +1086,40 @@ TEST_F(SqliteReaderTest, 
InferFloatToStringPreservesRoundTripPrecision) {
       expect_round_trip(reader.array_view->children[1], expected_append));
 }
 
+TEST_F(SqliteReaderTest, InferFloatToStringUsesDotDecimalInCommaLocale) {
+  const char* current_locale = std::setlocale(LC_NUMERIC, nullptr);
+  ASSERT_NE(nullptr, current_locale);
+  const std::string original_locale(current_locale);
+
+  const char* comma_locales[] = {"de_DE.UTF-8", "de_DE.utf8", "de_DE",
+                                 "German_Germany.1252"};
+  bool comma_locale_available = false;
+  for (const char* locale : comma_locales) {
+    if (std::setlocale(LC_NUMERIC, locale) != nullptr &&
+        std::strcmp(std::localeconv()->decimal_point, ",") == 0) {
+      comma_locale_available = true;
+      break;
+    }
+  }
+  if (!comma_locale_available) {
+    std::setlocale(LC_NUMERIC, original_locale.c_str());
+    GTEST_SKIP() << "No decimal-comma locale is installed";
+  }
+
+  struct RestoreLocale {
+    std::string name;
+    ~RestoreLocale() { std::setlocale(LC_NUMERIC, name.c_str()); }
+  } restore{original_locale};

Review Comment:
   Moved the table setup and statement preparation before changing 
`LC_NUMERIC`; reader inference still runs under the decimal-comma locale. The 
focused regression and SQLite CTest target pass.



-- 
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: [email protected]

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

Reply via email to