Skip to content

Relabel UTC aliases when projecting timestamptz_ns columns - #4468

Merged
Fokko merged 3 commits into
apache:mainfrom
g0itb4:fix-timestamptz-ns-utc-alias
Nov 26, 2026
Merged

Fokko merged 3 commits into
apache:mainfrom
g0itb4:fix-timestamptz-ns-utc-alias

Conversation

@g0itb4

@g0itb4 g0itb4 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Closes #4467

Rationale for this change

_cast_if_needed relabels a UTC alias (+00:00, Etc/UTC, Z) to UTC for timestamptz
columns but not for timestamptz_ns. A table whose files come from writers that label UTC
differently, or where some files predate the column, then fails in pa.concat_tables. This adds
the same handling for TimestamptzNanoType, for nanosecond values only: no unit conversion, so a
value is never widened or truncated.

Are these changes tested?

Yes. test__to_requested_schema_timestamptz_ns_utc_alias_concatenates projects a file without the
column and a file with a +00:00-labelled timestamp[ns] column, checks the label is UTC, and
concatenates them; nanosecond digits are kept. It fails on main and passes with the change.

Are there any user-facing changes?

Scans of such tables succeed instead of raising ArrowTypeError. No API change.

@Fokko
Fokko self-requested a review November 26, 2026 15:59

@Fokko Fokko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @g0itb4 for fixing this!

@Fokko
Fokko enabled auto-merge November 26, 2026 16:08

@Fokko Fokko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks @g0itb4! Nice catch on the ns path, and the concat test is a great repro. 🙌

@Fokko
Fokko added this pull request to the merge queue Nov 26, 2026
Merged via the queue into apache:main with commit 49413d1 Nov 26, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scan fails when a timestamptz_ns column's files label UTC as "+00:00" and other files lack the column

2 participants