fix(datagen): make default temporal ranges deterministic - #8121
Merged
Conversation
The default sampling ranges for rand_date32, rand_date64, and rand_timestamp were anchored to Utc::now(), so the same RNG seed generated different values depending on when the generator was created. This broke reproducibility of the rand_type / rand_field paths, e.g. for saved fuzz inputs involving temporal columns. Anchor the default one-year range to a fixed instant (the 365 days ending at 2024-01-01T00:00:00Z) instead. Callers that need a time-relative range can use the *_in_range variants. Also pin exact expected values in a new test so any future nondeterminism or accidental anchor change fails loudly, and adjust query test predicates that assumed generated temporal values were near the current date. Fixes #7913 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzLGemSfdM8i7PRi8YwJAZ
There was a problem hiding this comment.
The wall-clock dependency breaks same-seed reproducibility in default temporal generation. The fixed one-year range removes that dependency across Date32, Date64, and every timestamp resolution while leaving explicit-range APIs for rolling data. Targeted generator and query tests pass, and I found no correctness, compatibility, or performance issue that should block this change.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Closes #7913
Problem
The default temporal generators in
lance-datagen(rand_date32,rand_date64,rand_timestamp) derived their one-year sampling range fromUtc::now()at generator construction time. The RNG stream itself is deterministic, but it was mapped onto a moving wall-clock-dependent range, so the same generation parameters and RNG seed produced different arrays depending on when the generator was created. This also affected the corresponding paths throughrand_type/rand_field, breaking reproducibility of saved fuzz inputs involving temporal columns.Fix
default_temporal_range()helper. Callers that need a time-relative range can use the existing*_in_rangevariants, as the updated doc comments now point out.test_rng_temporal_deterministic, pinning exact expected values forrand_date32,rand_date64, and all four timestamp resolutions under the default seed. Pinned values fail on any reintroduction of wall-clock dependence (a generate-twice comparison could falsely pass when both constructions land in the same millisecond).test_query_date/test_query_timestampintegration tests from> DATE '2024-01-01'to> DATE '2023-07-01': with the fixed range ending at 2024-01-01 the old literals would trivially match zero rows, and a mid-range literal keeps the filters actually splitting the generated data.Verification
cargo test -p lance-datagen— 12 passed, including the new pinned-value testcargo test -p lance --features slow_tests --test integration_tests -- test_query_date test_query_timestamp— 6 passedcargo check --workspace --tests --benches— cleancargo fmt --allandcargo clippy -p lance-datagen --tests --benches -- -D warnings— clean🤖 Generated with Claude Code
https://claude.ai/code/session_01GzLGemSfdM8i7PRi8YwJAZ
Generated by Claude Code