Repository navigation
fix(transform): compute year and month in UTC - #3237
jaideeppyne wants to merge 4 commits into
Conversation
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
|
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. |
|
This is still relevant and up to date with main. I'd appreciate a review whenever someone has time, thanks! |
Baunsgaard
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Thanks for the follow-up, all four points are addressed and the test is better than what I suggested.
Which issue does this PR close?
Closes #3142.
What changes are included in this PR?
Arrow's
date_partobserves 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.