API: Support UUIDv7-derived timestamps in year/month/day/hour partition transforms - #17895
Open
bujjibabukatta wants to merge 2 commits into
Open
API: Support UUIDv7-derived timestamps in year/month/day/hour partition transforms#17895bujjibabukatta wants to merge 2 commits into
bujjibabukatta wants to merge 2 commits into
Conversation
bujjibabukatta
force-pushed
the
fix/#17892
branch
from
August 31, 2026 03:39
656efae to
8784e4b
Compare
pvary
reviewed
Aug 31, 2026
| if (uuid == null) { | ||
| return null; | ||
| } | ||
| long unixMillis = uuid.getMostSignificantBits() >>> VERSION_AND_RAND_A_BITS; |
Contributor
There was a problem hiding this comment.
How do we know that the UUID is actually an UUIDv7?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Lets Iceberg's year, month, day, and hour partition transforms work directly on a UUID column. If that column holds UUIDv7 values, the transform pulls out the timestamp already embedded in the UUID and buckets it just like a real TIMESTAMP column would. One ID column can now support both point lookups and time-range pruning — no second timestamp column needed.
Addresses #17892.
Root Cause:
UUIDv7 IDs already contain a creation timestamp in their first 48 bits, but Iceberg's time transforms only accept DATE, TIMESTAMP, and TIMESTAMP_NANO as input. There's no path from a UUID column into those transforms, so that timestamp goes unused for partitioning.
Fix:
Added UUIDv7Timestamps.java — extracts the millisecond timestamp from a UUID and converts it to year/month/day/hour.
Updated TimeTransform.java to accept UUID as a valid source type.
Updated Years, Months, Days, Hours to route UUID columns to the new logic.