Skip to content

fix(transform): compute year and month in UTC - #3237

Open
jaideeppyne wants to merge 4 commits into
apache:mainfrom
jaideeppyne:fix/year-month-utc
Open

jaideeppyne wants to merge 4 commits into
apache:mainfrom
jaideeppyne:fix/year-month-utc

Conversation

@jaideeppyne

@jaideeppyne jaideeppyne commented Sep 16, 2026 •

Copy link
Copy Markdown

Which issue does this PR close?

Closes #3142.

What changes are included in this PR?

Arrow's date_part observes timestamp timezone tags, whereas Iceberg year/month transforms use UTC. Retag timestamp arrays as UTC without changing epoch values, including second and millisecond inputs accepted by the public array-transform path.

Are these changes tested?

Hosted verification passed: 39 temporal tests, 2,121 library tests (one existing ignored test), and Clippy for the Iceberg crate's targets/features. The regression covers all four timestamp units, positive/negative/zero fixed offsets and no tag, the epoch boundary, and nulls.

AI Disclosure

Implementation and tests prepared with OpenAI Codex. The behavior to review is that year/month use UTC for every Arrow timestamp unit, including units not represented in Iceberg schemas. Retagging preserves the timestamp unit and epoch values; no timezone-database feature is needed by these tests.

Year and Month used Arrow date_part, which converts into the array's
timezone tag before reading the calendar field. Iceberg computes those
transforms in UTC, and transform_literal already did.

Retag timestamp arrays as +00:00 before date_part so array and literal
paths agree for non-UTC tags.

Closes apache#3142
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Oct 17, 2026
@jaideeppyne

Copy link
Copy Markdown
Author

This is still relevant and up to date with main. I'd appreciate a review whenever someone has time, thanks!

@github-actions github-actions Bot removed the stale label Oct 18, 2026

@Baunsgaard Baunsgaard 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 for picking this up! The fix looks correct: retagging only swaps timezone metadata, so Year/Month use UTC calendar fields. That matches this crate's transform_literal and Java DateTimeUtil, which always uses ZoneOffset.UTC (there is no Arrow timezone tag on the Java path).

@Baunsgaard Baunsgaard 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 for the follow-up, all four points are addressed and the test is better than what I suggested.

This branch has not been deployed

No deployments
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.

Year and Month transforms depend on the input array's timezone tag; Iceberg computes them in UTC

2 participants