From e229100c75d76846e9b83674693e888b3d4c8501 Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Wed, 17 May 2023 10:47:38 +0100 Subject: [PATCH 1/3] Update condition to pass if conditions match --- cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc b/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc index a88ce389360..5519df0a6ec 100644 --- a/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc +++ b/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc @@ -120,7 +120,7 @@ struct AssumeTimezoneExtractor static Status Exec(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { const AssumeTimezoneOptions& options = AssumeTimezoneState::Get(ctx); const auto& timezone = GetInputTimezone(*batch[0].type()); - if (!timezone.empty()) { + if (!timezone.empty() && timezone != options.timezone) { return Status::Invalid("Timestamps already have a timezone: '", timezone, "'. Cannot localize to '", options.timezone, "'."); } From 257eb169c05503862d817b8b35a40f85a48ea22e Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Wed, 17 May 2023 15:21:55 +0100 Subject: [PATCH 2/3] Remove additional test --- r/tests/testthat/test-dplyr-funcs-datetime.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/tests/testthat/test-dplyr-funcs-datetime.R b/r/tests/testthat/test-dplyr-funcs-datetime.R index d59356ad659..fc1a4de692d 100644 --- a/r/tests/testthat/test-dplyr-funcs-datetime.R +++ b/r/tests/testthat/test-dplyr-funcs-datetime.R @@ -289,7 +289,7 @@ test_that("timestamp round trip correctly via strftime and strptime", { # Some formats are not supported on Windows if (!tolower(Sys.info()[["sysname"]]) == "windows") { - formats <- c(formats, "%a", "%A", "%b", "%B", "%OS", "%I%p", "%r", "%T%z") + formats <- c(formats, "%a", "%A", "%b", "%B", "%OS", "%I%p", "%r") } for (fmt in formats) { From e8e7f116a9c75ff084b780c84f1205e88bb5d8fc Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Wed, 17 May 2023 16:37:10 +0100 Subject: [PATCH 3/3] Revert unnecessary change --- cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc b/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc index 5519df0a6ec..a88ce389360 100644 --- a/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc +++ b/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc @@ -120,7 +120,7 @@ struct AssumeTimezoneExtractor static Status Exec(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { const AssumeTimezoneOptions& options = AssumeTimezoneState::Get(ctx); const auto& timezone = GetInputTimezone(*batch[0].type()); - if (!timezone.empty() && timezone != options.timezone) { + if (!timezone.empty()) { return Status::Invalid("Timestamps already have a timezone: '", timezone, "'. Cannot localize to '", options.timezone, "'."); }