fix(dq): partition decoded tables by real dates, not day-of-month#20
Merged
Conversation
DuckLake's day(x) is a component extraction — day-of-month 1-31, not a
date truncation — so PARTITIONED BY (subject_bucket, day("timestamp"))
on lake.signals/lake.events cycled 31 time buckets that mixed every
month forever. Partitions never closed, and the anti-join dedup probe's
"day partition" pruning was pruning day-of-month, not dates.
Replace it with the year/month/day triple, the documented DuckLake
daily-partition shape. The _latest rollups stay subject_bucket-only.
Companion to DIMO-Network/din fix/date-partition-triple (raw_events).
No live-catalog migration: the ALTERs only run at table creation, so
deployed environments (all droppable) need a fresh catalog on deploy.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
day(x)in DuckLake is a component extraction — day-of-month 1–31, not a date truncation — soPARTITIONED BY (subject_bucket, day("timestamp"))onlake.signals/lake.eventsproduced 31 cycling time buckets that mix every month forever (day=9collects Jul 9, Aug 9, Dec 9, …). Partitions never close, and the anti-join dedup probe's "day partition" pruning was actually pruning on day-of-month.Fix
Use the documented DuckLake daily-partition shape — the year/month/day triple:
The
signals_latest/events_latestrollups staysubject_bucket-only, unchanged.Notes
setupStatements):ducklake_merge_adjacent_filesonly consolidates within one partition, so a low-traffic (bucket, day) keeps its tiny files forever. Accepted for layout legibility.raw_events).Testing
Full
go test ./...passes.🤖 Generated with Claude Code