Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,13 @@ jobs:
export CMAKE_BUILD_PARALLEL_LEVEL=$NUMBER_OF_PROCESSORS
ci/scripts/cpp_build.sh "$(pwd)" "$(pwd)/build"
- name: Download Timezone Database
if: matrix.msystem_upper == 'CLANG64'
shell: bash
run: ci/scripts/download_tz_database.sh
run: |
# TODO(GH-48743): msys2 clang64 uses libc++ and vendored date.h library
# which needs tzdata database to build Arrow with time zone support.
# https://github.com/apache/arrow/issues/48743
ci/scripts/download_tz_database.sh
- name: Download MinIO
shell: msys2 {0}
run: |
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/cpp_extra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,6 @@ jobs:
with:
fetch-depth: 0
submodules: recursive
- name: Download Timezone Database
shell: bash
run: ci/scripts/download_tz_database.sh
- name: Install cmake
shell: bash
run: |
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/cpp_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ jobs:
with:
fetch-depth: 0
submodules: recursive
- name: Download Timezone Database
shell: bash
run: ci/scripts/download_tz_database.sh
- name: Install msys2 (for tzdata for ORC tests)
uses: msys2/setup-msys2@v2
id: setup-msys2
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/matlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ jobs:
uses: matlab-actions/setup-matlab@v2
with:
release: R2025b
- name: Download Timezone Database
shell: bash
run: ci/scripts/download_tz_database.sh
- name: Install ccache
shell: bash
run: ci/scripts/install_ccache.sh 4.6.3 /usr
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/arrow/compute/function_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,9 @@ TEST(FunctionOptions, Equality) {
options.emplace_back(new StrptimeOptions("%Y", TimeUnit::type::MILLI, true));
options.emplace_back(new StrptimeOptions("%Y", TimeUnit::type::NANO));
options.emplace_back(new StrftimeOptions("%Y-%m-%dT%H:%M:%SZ", "C"));
#ifndef _WIN32
options.emplace_back(new AssumeTimezoneOptions(
"Europe/Amsterdam", AssumeTimezoneOptions::Ambiguous::AMBIGUOUS_RAISE,
AssumeTimezoneOptions::Nonexistent::NONEXISTENT_RAISE));
#endif
options.emplace_back(new PadOptions(5, " "));
options.emplace_back(new PadOptions(10, "A"));
options.emplace_back(new PadOptions(10, "A", false));
Expand Down
15 changes: 6 additions & 9 deletions cpp/src/arrow/compute/kernels/scalar_cast_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2358,15 +2358,7 @@ constexpr char kTimestampSecondsJson[] =
constexpr char kTimestampExtremeJson[] =
R"(["1677-09-20T00:00:59.123456", "2262-04-13T23:23:23.999999"])";

class CastTimezone : public ::testing::Test {
protected:
void SetUp() override {
#ifdef _WIN32
// Initialize timezone database on Windows
ASSERT_OK(InitTestTimezoneDatabase());
#endif
}
};
class CastTimezone : public ::testing::Test {};

TEST(Cast, TimestampToDate) {
// See scalar_temporal_test.cc
Expand Down Expand Up @@ -2595,6 +2587,11 @@ TEST(Cast, TimestampToTime) {
}

TEST_F(CastTimezone, ZonedTimestampToTime) {
// TODO(GH-48743): GCC libstdc++ has a bug with DST transitions
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116110
#if defined(_WIN32) && defined(__GNUC__) && !defined(__clang__)
GTEST_SKIP() << "Test triggers GCC libstdc++ bug (GH-48743).";
#endif
CheckCast(ArrayFromJSON(timestamp(TimeUnit::NANO, "Pacific/Marquesas"), kTimestampJson),
ArrayFromJSON(time64(TimeUnit::NANO), R"([
52259123456789, 50003999999999, 56480001001001, 65000000000000,
Expand Down
43 changes: 22 additions & 21 deletions cpp/src/arrow/compute/kernels/scalar_temporal_binary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "arrow/util/checked_cast.h"
#include "arrow/util/logging_internal.h"
#include "arrow/util/time.h"
#include "arrow/vendored/datetime.h"

namespace arrow {

Expand All @@ -37,28 +36,30 @@ using internal::checked_pointer_cast;
namespace compute {
namespace internal {

namespace chrono = arrow::internal::chrono;

namespace {

using arrow_vendored::date::days;
using arrow_vendored::date::floor;
using arrow_vendored::date::hh_mm_ss;
using arrow_vendored::date::local_days;
using arrow_vendored::date::local_time;
using arrow_vendored::date::sys_days;
using arrow_vendored::date::sys_time;
using arrow_vendored::date::trunc;
using arrow_vendored::date::weekday;
using arrow_vendored::date::weeks;
using arrow_vendored::date::year_month_day;
using arrow_vendored::date::year_month_weekday;
using arrow_vendored::date::years;
using arrow_vendored::date::literals::dec;
using arrow_vendored::date::literals::jan;
using arrow_vendored::date::literals::last;
using arrow_vendored::date::literals::mon;
using arrow_vendored::date::literals::sun;
using arrow_vendored::date::literals::thu;
using arrow_vendored::date::literals::wed;
using chrono::days;
using chrono::dec;
using chrono::floor;
using chrono::hh_mm_ss;
using chrono::jan;
using chrono::last;
using chrono::local_days;
using chrono::local_time;
using chrono::mon;
using chrono::sun;
using chrono::sys_days;
using chrono::sys_time;
using chrono::thu;
using chrono::trunc;
using chrono::wed;
using chrono::weekday;
using chrono::weeks;
using chrono::year_month_day;
using chrono::year_month_weekday;
using chrono::years;
using internal::applicator::ScalarBinaryNotNullStatefulEqualTypes;

using DayOfWeekState = OptionsWrapper<DayOfWeekOptions>;
Expand Down
34 changes: 26 additions & 8 deletions cpp/src/arrow/compute/kernels/scalar_temporal_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "arrow/type_fwd.h"
#include "arrow/type_traits.h"
#include "arrow/util/checked_cast.h"
#include "arrow/util/chrono_internal.h" // for ARROW_USE_STD_CHRONO
#include "arrow/util/formatting.h"
#include "arrow/util/logging_internal.h"

Expand Down Expand Up @@ -411,14 +412,6 @@ class ScalarTemporalTest : public ::testing::Test {
RoundTemporalOptions round_to_15_quarters =
RoundTemporalOptions(15, CalendarUnit::QUARTER);
RoundTemporalOptions round_to_15_years = RoundTemporalOptions(15, CalendarUnit::YEAR);

protected:
void SetUp() override {
#ifdef _WIN32
// Initialize timezone database on Windows
ASSERT_OK(InitTestTimezoneDatabase());
#endif
}
};

class ScalarTemporalTestStrictCeil : public ScalarTemporalTest {
Expand Down Expand Up @@ -716,6 +709,11 @@ TEST_F(ScalarTemporalTest, TestIsLeapYear) {
}

TEST_F(ScalarTemporalTest, TestZoned1) {
// TODO(GH-48743): GCC libstdc++ has a bug with DST transitions
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116110
#if defined(_WIN32) && defined(__GNUC__) && !defined(__clang__)
GTEST_SKIP() << "Test triggers GCC libstdc++ bug (GH-48743).";
#endif
std::vector<std::string> timezones = {"Pacific/Marquesas", "-09:30"};
for (const auto& timezone : timezones) {
auto unit = timestamp(TimeUnit::NANO, timezone);
Expand Down Expand Up @@ -814,6 +812,11 @@ TEST_F(ScalarTemporalTest, TestZoned1) {
}

TEST_F(ScalarTemporalTest, TestZoned2) {
// TODO(GH-48743): GCC libstdc++ has a bug with DST transitions
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116110
#if defined(_WIN32) && defined(__GNUC__) && !defined(__clang__)
GTEST_SKIP() << "Test triggers GCC libstdc++ bug (GH-48743).";
#endif
for (auto u : TimeUnit::values()) {
auto unit = timestamp(u, "Australia/Broken_Hill");
auto month = "[1, 3, 1, 5, 1, 12, 12, 12, 1, 1, 1, 1, 12, 12, 12, 1, null]";
Expand Down Expand Up @@ -2775,6 +2778,11 @@ TEST_F(ScalarTemporalTestMultipleSinceGreaterUnit, CeilUTC) {
}

TEST_F(ScalarTemporalTestMultipleSinceGreaterUnit, CeilZoned) {
// TODO(GH-48743): GCC libstdc++ has a bug with DST transitions
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116110
#if defined(_WIN32) && defined(__GNUC__) && !defined(__clang__)
GTEST_SKIP() << "Test triggers GCC libstdc++ bug (GH-48743).";
#endif
std::string op = "ceil_temporal";

// Data for tests below was generated via lubridate with the exception
Expand Down Expand Up @@ -3165,6 +3173,11 @@ TEST_F(ScalarTemporalTestMultipleSinceGreaterUnit, FloorUTC) {
}

TEST_F(ScalarTemporalTestMultipleSinceGreaterUnit, FloorZoned) {
// TODO(GH-48743): GCC libstdc++ has a bug with DST transitions
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116110
#if defined(_WIN32) && defined(__GNUC__) && !defined(__clang__)
GTEST_SKIP() << "Test triggers GCC libstdc++ bug (GH-48743).";
#endif
std::string op = "floor_temporal";

// Data for tests below was generated via lubridate with the exception
Expand Down Expand Up @@ -3598,6 +3611,11 @@ TEST_F(ScalarTemporalTestMultipleSinceGreaterUnit, RoundUTC) {
}

TEST_F(ScalarTemporalTestMultipleSinceGreaterUnit, RoundZoned) {
// TODO(GH-48743): GCC libstdc++ has a bug with DST transitions
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116110
#if defined(_WIN32) && defined(__GNUC__) && !defined(__clang__)
GTEST_SKIP() << "Test triggers GCC libstdc++ bug (GH-48743).";
#endif
std::string op = "round_temporal";

// Data for tests below was generated via lubridate with the exception
Expand Down
74 changes: 36 additions & 38 deletions cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "arrow/util/logging_internal.h"
#include "arrow/util/time.h"
#include "arrow/util/value_parsing.h"
#include "arrow/vendored/datetime.h"

namespace arrow {

Expand All @@ -38,34 +37,36 @@ using internal::checked_pointer_cast;

namespace compute::internal {

namespace chrono = arrow::internal::chrono;

namespace {

using arrow_vendored::date::ceil;
using arrow_vendored::date::days;
using arrow_vendored::date::floor;
using arrow_vendored::date::hh_mm_ss;
using arrow_vendored::date::local_days;
using arrow_vendored::date::local_time;
using arrow_vendored::date::locate_zone;
using arrow_vendored::date::Monday;
using arrow_vendored::date::months;
using arrow_vendored::date::round;
using arrow_vendored::date::Sunday;
using arrow_vendored::date::sys_time;
using arrow_vendored::date::trunc;
using arrow_vendored::date::weekday;
using arrow_vendored::date::weeks;
using arrow_vendored::date::year;
using arrow_vendored::date::year_month_day;
using arrow_vendored::date::year_month_weekday;
using arrow_vendored::date::years;
using arrow_vendored::date::literals::dec;
using arrow_vendored::date::literals::jan;
using arrow_vendored::date::literals::last;
using arrow_vendored::date::literals::mon;
using arrow_vendored::date::literals::sun;
using arrow_vendored::date::literals::thu;
using arrow_vendored::date::literals::wed;
using chrono::ceil;
using chrono::days;
using chrono::dec;
using chrono::floor;
using chrono::hh_mm_ss;
using chrono::jan;
using chrono::last;
using chrono::local_days;
using chrono::local_time;
using chrono::locate_zone;
using chrono::mon;
using chrono::Monday;
using chrono::months;
using chrono::round;
using chrono::sun;
using chrono::Sunday;
using chrono::sys_time;
using chrono::thu;
using chrono::trunc;
using chrono::wed;
using chrono::weekday;
using chrono::weeks;
using chrono::year;
using chrono::year_month_day;
using chrono::year_month_weekday;
using chrono::years;
using std::chrono::duration_cast;
using std::chrono::hours;
using std::chrono::minutes;
Expand Down Expand Up @@ -525,8 +526,8 @@ struct Week {
}

Localizer localizer_;
arrow_vendored::date::weekday wd_;
arrow_vendored::date::days days_offset_;
chrono::weekday wd_;
chrono::days days_offset_;
const bool count_from_zero_;
const bool first_week_is_fully_in_year_;
};
Expand Down Expand Up @@ -1379,35 +1380,32 @@ struct AssumeTimezone {
T Call(KernelContext*, Arg0 arg, Status* st) const {
try {
return get_local_time<T, Arg0>(arg, &tz_);
} catch (const arrow_vendored::date::nonexistent_local_time& e) {
} catch (const chrono::nonexistent_local_time& e) {
switch (options.nonexistent) {
case AssumeTimezoneOptions::Nonexistent::NONEXISTENT_RAISE: {
*st = Status::Invalid("Timestamp doesn't exist in timezone '", options.timezone,
"': ", e.what());
return arg;
}
case AssumeTimezoneOptions::Nonexistent::NONEXISTENT_EARLIEST: {
return get_local_time<T, Arg0>(arg, arrow_vendored::date::choose::latest,
&tz_) -
1;
return get_local_time<T, Arg0>(arg, chrono::choose::latest, &tz_) - 1;
}
case AssumeTimezoneOptions::Nonexistent::NONEXISTENT_LATEST: {
return get_local_time<T, Arg0>(arg, arrow_vendored::date::choose::latest, &tz_);
return get_local_time<T, Arg0>(arg, chrono::choose::latest, &tz_);
}
}
} catch (const arrow_vendored::date::ambiguous_local_time& e) {
} catch (const chrono::ambiguous_local_time& e) {
switch (options.ambiguous) {
case AssumeTimezoneOptions::Ambiguous::AMBIGUOUS_RAISE: {
*st = Status::Invalid("Timestamp is ambiguous in timezone '", options.timezone,
"': ", e.what());
return arg;
}
case AssumeTimezoneOptions::Ambiguous::AMBIGUOUS_EARLIEST: {
return get_local_time<T, Arg0>(arg, arrow_vendored::date::choose::earliest,
&tz_);
return get_local_time<T, Arg0>(arg, chrono::choose::earliest, &tz_);
}
case AssumeTimezoneOptions::Ambiguous::AMBIGUOUS_LATEST: {
return get_local_time<T, Arg0>(arg, arrow_vendored::date::choose::latest, &tz_);
return get_local_time<T, Arg0>(arg, chrono::choose::latest, &tz_);
}
}
}
Expand Down
Loading
Loading