fix: verification_v2 mvs are missing outcome in sort key#2724
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Warning Rate limit exceeded@chronark has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 32 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (5)
📝 Walkthrough📝 Walkthrough📝 WalkthroughWalkthroughThis pull request introduces several SQL files that create new tables and materialized views in the ClickHouse Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thank you for following the naming conventions for pull request titles! 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Outside diff range and nitpick comments (2)
internal/clickhouse/src/verification_outcomes_propagate_correctly.test.ts (1)
86-105: Enhance test coverage with edge casesWhile the test covers basic aggregation validation, consider adding edge cases:
- Verifications exactly at bucket boundaries
- Empty buckets within the time range
- All verifications having the same outcome
internal/clickhouse/src/verifications.ts (1)
Line range hint
63-135: Consider adding ORDER BY clause in materialized viewsThe queries rely on sorted results (ORDER BY time ASC), but it's more efficient to maintain this order in the materialized views rather than sorting on each query.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (11)
internal/clickhouse/schema/036_create_verifications.key_verifications_per_hour_v3.sql(1 hunks)internal/clickhouse/schema/037_create_verifications.key_verifications_per_hour_mv_v3.sql(1 hunks)internal/clickhouse/schema/038_create_verifications.key_verifications_per_day_v3.sql(1 hunks)internal/clickhouse/schema/039_create_verifications.key_verifications_per_day_mv_v3.sql(1 hunks)internal/clickhouse/schema/040_create_verifications.key_verifications_per_month_v3.sql(1 hunks)internal/clickhouse/schema/041_create_verifications.key_verifications_per_month_mv_v3.sql(1 hunks)internal/clickhouse/src/client/client.ts(0 hunks)internal/clickhouse/src/verification_outcomes_propagate_correctly.test.ts(1 hunks)internal/clickhouse/src/verifications.ts(3 hunks)internal/clickhouse/vitest.config.ts(1 hunks)x.json(1 hunks)
💤 Files with no reviewable changes (1)
- internal/clickhouse/src/client/client.ts
✅ Files skipped from review due to trivial changes (2)
- internal/clickhouse/schema/038_create_verifications.key_verifications_per_day_v3.sql
- internal/clickhouse/schema/036_create_verifications.key_verifications_per_hour_v3.sql
🔇 Additional comments (6)
internal/clickhouse/vitest.config.ts (1)
5-5: LGTM: Appropriate test configuration for database schema changes
Setting bail: 1 is a good choice here as it will stop the test suite on the first failure, which is particularly useful for database schema tests where subsequent tests may depend on the success of previous ones.
internal/clickhouse/schema/040_create_verifications.key_verifications_per_month_v3.sql (1)
13-14: LGTM: Correctly includes outcome in ORDER BY clause
The table definition properly includes outcome in the ORDER BY clause, which addresses the issue mentioned in the PR title. The SummingMergeTree engine with this ordering will enable efficient querying of verification data by all key dimensions including outcome.
internal/clickhouse/schema/037_create_verifications.key_verifications_per_hour_mv_v3.sql (2)
1-23: LGTM! Materialized view properly includes outcome field
The materialized view correctly includes the outcome field in both SELECT and GROUP BY clauses, which addresses the missing outcome issue mentioned in the PR title.
26-46: Consider uncommenting the data population script if migration is needed
The commented data population script could be useful for migrating existing data to the new materialized view. Consider uncommenting it if historical data needs to be preserved.
Let's check if there's existing data that needs migration:
internal/clickhouse/schema/041_create_verifications.key_verifications_per_month_mv_v3.sql (1)
1-23: LGTM! Monthly materialized view properly includes outcome field
The materialized view correctly includes the outcome field and uses appropriate monthly time aggregation.
internal/clickhouse/src/verification_outcomes_propagate_correctly.test.ts (1)
49-50: Consider uncommenting the delay for materialized view propagation
The commented delay might be necessary to ensure materialized views are properly populated before querying. Without it, tests might be flaky if ClickHouse hasn't processed all insertions.
Let's check if there are any timing-related test failures:
Summary by CodeRabbit
New Features
tagsproperty to key verification requests for enhanced filtering and aggregation.Bug Fixes
Tests
Chores