Skip to content

GH-30036: [C++] Timezone-aware kernels should handle offset strings (e.g. "+04:30") - #12865

Merged
rok merged 23 commits into
apache:mainfrom
rok:ARROW-14477
Oct 7, 2025
Merged

GH-30036: [C++] Timezone-aware kernels should handle offset strings (e.g. "+04:30")#12865
rok merged 23 commits into
apache:mainfrom
rok:ARROW-14477

Conversation

@rok

@rokrok commented Apr 12, 2022

Copy link
Copy Markdown
Member

ARROW-14477: #30036

Currently timestamp arrays have unit timestamp(unit, zone name). This would add "offset timezones" where timestamp array would also support units like timestamp(unit, "+/-HH:MM").

@rok

rok commented Apr 12, 2022

Copy link
Copy Markdown
MemberAuthor

@pitrou@lidavidm@jorisvandenbossche this is complete yet but I would like to validate the approach with you before I continue. Do you feel this makes enough sense to complete the PR?
Please note date.h recognises zones names like "Etc/GMT+10" but only in iterations of 1hr, while we might want to cover 30 minute iterations. I'm basing this off of the date.h recommendation for custom time zones.

@pitrou

Copy link
Copy Markdown
Member

Please note date.h recognises zones names like "Etc/GMT+10" but only in iterations of 1hr, while we might want to cover 30 minute iterations.

What is this comment in reference to? It seems this PR would handle 30 minute iterations correctly?

Comment threadcpp/src/arrow/vendored/datetime/tz.h Outdated
@rok

rok commented Apr 12, 2022

Copy link
Copy Markdown
MemberAuthor

What is this comment in reference to? It seems this PR would handle 30 minute iterations correctly?

Current implementation can handle fixed offsets of iterations of one hour. This PR would enable offsets of arbitrary number of minutes. So primary use of that would indeed be to operate in GMT+/-HH:30 offsets. Otherwise we don't need an extra type just a translation utility for +/-HH:00 -> Etc/GMT+/-HH.

@github-actions

Copy link
Copy Markdown

@rok
rokforce-pushed the ARROW-14477 branch 2 times, most recently from ead6a33 to b7c3038CompareApril 22, 2022 03:08
Comment threadcpp/src/arrow/util/date_internal.h Outdated
@github-actionsgithub-actionsBot added the awaiting review Awaiting review label Jul 11, 2025
@rok
rokforce-pushed the ARROW-14477 branch 9 times, most recently from 0f1f432 to 53ec435CompareJuly 13, 2025 22:22
@rokrok changed the title ARROW-14477: [C++] Timezone-aware kernels should also handle offset stringsARROW-14477: [C++] Timezone-aware kernels should handle offset strings (e.g. "+04:30")Jul 13, 2025
@rok
rok marked this pull request as ready for review July 13, 2025 22:31
@rok
rok requested a review from pitrouJuly 13, 2025 23:39
@rokrok linked an issue Jul 14, 2025 that may be closed by this pull request
Comment threadcpp/src/arrow/compute/kernels/temporal_internal.h Outdated
@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Jul 14, 2025
namespace compute {
namespace internal {

#include "arrow/compute/kernels/codegen_internal.h"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is codegen_internal.h for here?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to get arrow::compute::internal::applicator::ScalarUnaryNotNullStateful and arrow::compute::match::TimestampTypeUnit.

std::chrono::minutes zone_offset;
switch (timezone.length()) {
case 6:
if (arrow::internal::detail::ParseHH_MM(offset.c_str(), &zone_offset)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably update this to operate on string_view but that can be done later

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #47732

@rok

rok commented Oct 7, 2025

Copy link
Copy Markdown
MemberAuthor

Thank you for the review @lidavidm !
I'll rebase and merge if CI passes.
edit: also added a minimal Python test

@rok

rok commented Oct 7, 2025

Copy link
Copy Markdown
MemberAuthor

@github-actions crossbow submit -g cpp

@github-actions

Copy link
Copy Markdown

Revision: 936d020

Submitted crossbow builds: ursacomputing/crossbow @ actions-744a53bba9

TaskStatus
example-cpp-minimal-build-staticGitHub Actions
example-cpp-minimal-build-static-system-dependencyGitHub Actions
example-cpp-tutorialGitHub Actions
test-build-cpp-fuzzGitHub Actions
test-conda-cppGitHub Actions
test-conda-cpp-valgrindGitHub Actions
test-cuda-cpp-ubuntu-22.04-cuda-11.7.1GitHub Actions
test-debian-12-cpp-amd64GitHub Actions
test-debian-12-cpp-i386GitHub Actions
test-fedora-42-cppGitHub Actions
test-ubuntu-22.04-cppGitHub Actions
test-ubuntu-22.04-cpp-20GitHub Actions
test-ubuntu-22.04-cpp-bundledGitHub Actions
test-ubuntu-22.04-cpp-emscriptenGitHub Actions
test-ubuntu-22.04-cpp-no-threadingGitHub Actions
test-ubuntu-24.04-cppGitHub Actions
test-ubuntu-24.04-cpp-bundled-offlineGitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundledGitHub Actions
test-ubuntu-24.04-cpp-gcc-14GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formatsGitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizerGitHub Actions

@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 2 benchmarking runs that have been run so far on merge-commit bf342b2.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 3 possible false positives for unstable benchmarks that are known to sometimes produce them.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++] Timezone-aware kernels should handle offset strings (e.g. "+04:30")

4 participants

@rok@pitrou@zilto@lidavidm