From 5a63821a504b831ac97dfda1b6dc87462e567dce Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sat, 2 Nov 2024 15:29:20 +1100 Subject: [PATCH 1/3] [C++] skip `-0117` in StrptimeZoneOffset for old glibc --- cpp/src/arrow/util/value_parsing_test.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/cpp/src/arrow/util/value_parsing_test.cc b/cpp/src/arrow/util/value_parsing_test.cc index 7cd1ab1e25c31..9b6ddfbb19023 100644 --- a/cpp/src/arrow/util/value_parsing_test.cc +++ b/cpp/src/arrow/util/value_parsing_test.cc @@ -838,12 +838,26 @@ TEST(TimestampParser, StrptimeZoneOffset) { std::string format = "%Y-%d-%m %H:%M:%S%z"; auto parser = TimestampParser::MakeStrptime(format); + std::vector values = { + "2018-01-01 00:00:00+0000", + "2018-01-01 00:00:00+0100", +#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) +# if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 28) + "2018-01-01 00:00:00-0117", +# else + // glibc < 2.28 doesn't support "-0117" timezone offset. + // See also: https://github.com/apache/arrow/issues/43808 +# endif +#else + "2018-01-01 00:00:00-0117", +#endif + "2018-01-01 00:00:00+0130" + }; + // N.B. GNU %z supports ISO8601 format while BSD %z supports only // +HHMM or -HHMM and POSIX doesn't appear to define %z at all for (auto unit : TimeUnit::values()) { - for (const std::string value : - {"2018-01-01 00:00:00+0000", "2018-01-01 00:00:00+0100", - "2018-01-01 00:00:00+0130", "2018-01-01 00:00:00-0117"}) { + for (const std::string& value : values) { SCOPED_TRACE(value); int64_t converted = 0; int64_t expected = 0; From eb3e5519621d52c00d77118cb1de607ef28ef09c Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Mon, 11 Nov 2024 19:48:06 +1100 Subject: [PATCH 2/3] reshuffle to appease linter --- cpp/src/arrow/util/value_parsing_test.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cpp/src/arrow/util/value_parsing_test.cc b/cpp/src/arrow/util/value_parsing_test.cc index 9b6ddfbb19023..b31e429a3b916 100644 --- a/cpp/src/arrow/util/value_parsing_test.cc +++ b/cpp/src/arrow/util/value_parsing_test.cc @@ -842,11 +842,10 @@ TEST(TimestampParser, StrptimeZoneOffset) { "2018-01-01 00:00:00+0000", "2018-01-01 00:00:00+0100", #if defined(__GLIBC__) && defined(__GLIBC_MINOR__) +// glibc < 2.28 doesn't support "-0117" timezone offset. +// See also: https://github.com/apache/arrow/issues/43808 # if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 28) "2018-01-01 00:00:00-0117", -# else - // glibc < 2.28 doesn't support "-0117" timezone offset. - // See also: https://github.com/apache/arrow/issues/43808 # endif #else "2018-01-01 00:00:00-0117", From 798152b57a3c5dc5d2c875ae7c97c04b9a48775e Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 14 Nov 2024 16:21:58 +0900 Subject: [PATCH 3/3] Fix condition --- cpp/src/arrow/util/value_parsing_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/arrow/util/value_parsing_test.cc b/cpp/src/arrow/util/value_parsing_test.cc index b31e429a3b916..a833d266a85a7 100644 --- a/cpp/src/arrow/util/value_parsing_test.cc +++ b/cpp/src/arrow/util/value_parsing_test.cc @@ -844,7 +844,7 @@ TEST(TimestampParser, StrptimeZoneOffset) { #if defined(__GLIBC__) && defined(__GLIBC_MINOR__) // glibc < 2.28 doesn't support "-0117" timezone offset. // See also: https://github.com/apache/arrow/issues/43808 -# if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 28) +# if ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 28)) || (__GLIBC__ >= 3) "2018-01-01 00:00:00-0117", # endif #else