Skip to content

API: Support UUIDv7-derived timestamps in year/month/day/hour partition transforms - #17895

Open
bujjibabukatta wants to merge 2 commits into
apache:mainfrom
bujjibabukatta:fix/#17892
Open

API: Support UUIDv7-derived timestamps in year/month/day/hour partition transforms#17895
bujjibabukatta wants to merge 2 commits into
apache:mainfrom
bujjibabukatta:fix/#17892

Conversation

@bujjibabukatta

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the API label Aug 30, 2026
@bujjibabukatta bujjibabukatta changed the title [Draft] Support UUIDv7-derived timestamps in year/month/day/hour partition transforms Support UUIDv7-derived timestamps in year/month/day/hour partition transforms Aug 30, 2026
@bujjibabukatta bujjibabukatta changed the title Support UUIDv7-derived timestamps in year/month/day/hour partition transforms API: Support UUIDv7-derived timestamps in year/month/day/hour partition transforms Aug 31, 2026
if (uuid == null) {
return null;
}
long unixMillis = uuid.getMostSignificantBits() >>> VERSION_AND_RAND_A_BITS;

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.

How do we know that the UUID is actually an UUIDv7?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants