-
Notifications
You must be signed in to change notification settings - Fork 343
feat: Improve Date Range and Granularity handling for Materialized Views #1533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 251f167 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Code Review
✅ No critical issues found.
The PR makes solid improvements to materialized view query alignment and date range handling. The implementation is well-tested with comprehensive test coverage for edge cases.
Minor observations:
- Good: New test coverage for granularity validation (packages/common-utils/src/clickhouse/tests/materializedViews.test.ts:630-718)
- Good: Date range alignment is opt-in via
alignDateRangeToGranularityflag with sensible defaults - Good: Live mode correctly disables alignment to avoid stale cache (DBSearchPage.tsx:1360)
- Good: End-exclusive date ranges prevent double-counting at MV boundaries (materializedViews.ts:325)
Optional improvements (non-blocking):
- Consider documenting the
alignDateRangeToGranularityflag behavior in code comments for future maintainers - The
previousPeriodOffsetSecondscalculation could be extracted to a shared utility (currently duplicated in multiple places)
Recommendation: ✅ Approve and merge
E2E Test Results✅ All tests passed • 51 passed • 4 skipped • 695s
Tests ran across 4 shards in parallel. |
b69c64c to
251f167
Compare
Uh oh!
There was an error while loading. Please reload this page.
Closes HDX-3067
Closes #1331
Closes #1212
Closes #1468
Summary
This PR makes a number of improvements around the way we handle date ranges and granularities, in an effort to minimize discrepancies between aggregate values queried from original data and aggregate values queried from materialized views.
Demo
Show Complete Intervals Option
Screen.Recording.2025年12月29日.at.3.20.59.PM.mov