fix(tesseract): reduce_by/grain matches time dimensions regardless of granularity#11188
Conversation
|
Claude finished @waralexrom's task in 1m 16s —— View job Code ReviewLGTM — no blocking issues found (0 high, 0 medium, 1 low)
SummaryThe root-cause analysis in the PR description matches the code: projected time dimensions carry a granularity suffix ( Code quality is good: new method is documented with the why, the helper name is clearer than reusing Correctness
Both call sites ( Testing
Low — nit only
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11188 +/- ##
==========================================
- Coverage 83.70% 79.26% -4.45%
==========================================
Files 257 474 +217
Lines 79465 97013 +17548
Branches 0 3572 +3572
==========================================
+ Hits 66517 76894 +10377
- Misses 12948 19603 +6655
- Partials 0 516 +516
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… granularity A multi-stage reduce_by/grain reference to a bare time dimension silently no-oped. The projected time dimension carries a granularity suffix in its full name (created_at_month) while the reduce_by reference points at the bare dimension (created_at), so full_name matching never removed it from the window PARTITION BY. Every partition collapsed to one row (ranks all 1; aggregates fell back to plain group-by returning the un-reduced value). Add MemberSymbol::matches_grain_reference, which also matches a time dimension through its base symbol, and use it in both grain reshape sites (member_partition_by_logical and partition_filter). Covered by new Rust integration tests (cube and view paths) in multi_stage/reduce_by.rs, rank.rs and views.rs.
8768482 to
dc51a64
Compare
|
Claude finished @waralexrom's task in 35s —— View job Code ReviewLGTM — no blocking issues (0 high, 0 medium, 1 low nit). No new commits since prior review.
SummaryBranch still contains a single commit ( The fix — a dedicated Correctness
Both call sites ( Testing
Low — nit only
· Branch: |
Summary
A multi-stage
reduce_by/grainreference to a time dimension silently did nothing, producing wrong results with no error. Fixes #10854.The projected time dimension carries a granularity suffix in its full name (e.g.
created_at_month), while thereduce_byreference points at the bare dimension (created_at). Matching was done byfull_namestring equality, so the two never matched and the time dimension was never removed from the window'sPARTITION BY. Every partition collapsed to a single row — arankmeasure returned1for every row, and an aggregate silently fell back to a plain group-by returning the un-reduced value. String dimensions have no suffix, so they matched and worked; only time dimensions were affected.Changes
MemberSymbol::matches_grain_reference— behaves likehas_member_in_reference_chain, but a time dimension additionally matches through its underlying base dimension, so a bare grain reference removes it regardless of the granularity it is queried at.member_partition_by_logicalandpartition_filter) forexclude/keep_only.Testing
multi_stage/reduce_by.rs,rank.rs,views.rs. Each asserts a window is used,created_atis excluded fromPARTITION BY, and snapshots the executed results (per-group totals / correct ranks). All were red before the fix, green after.cubesqlplannersuite: 1073 passed, 0 failed.