Repository navigation
fix(tesseract): Keep every usage of a rollup that is also a rollupJoin leg - #12593
waralexrom wants to merge 2 commits into
Conversation
|
Claude finished @waralexrom's task in 1m 8s —— View job Looks correct, no blocking issues: 0 high, 0 medium, 2 low. Review details
Correctness (Tesseract only; the legacy planner never fills
|
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #12593 +/- ##
===========================================
- Coverage 83.16% 66.18% -16.98%
===========================================
Files 531 258 -273
Lines 124739 21997 -102742
Branches 5293 5295 +2
===========================================
- Hits 103734 14559 -89175
+ Misses 20209 6642 -13567
Partials 796 796
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:
|
|
Claude finished @waralexrom's task in 1m 32s —— View job LGTM, no blocking issues. 0 high, 0 medium, 1 low (process only, no inline comments). Review details
FindingsLow: The issue's model was reported against the legacy planner's Verified
Review threadsThe listing returned 2 of my own unresolved threads. I resolved both: date ranges are now merged through |
…n leg A query can read a rollup both on its own and as a leg of a rollupJoin, e.g. a measure of the joined cube is served by its own rollup next to the rollupJoin. Each usage produced a description of that rollup, and the descriptions were then deduplicated by table name, so the usage mapping of all but the first was dropped and the SQL read a `__usage_N` table that was never loaded. Descriptions of the same table are now merged, with the usage mappings of all of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…riptions Reuse mergeUsageDateRanges for the merged range and test the merge directly, since the rollupJoin test model has no partitioned rollups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e9b8c60 to
b072601
Compare
|
Claude finished @waralexrom's task in 1m 21s —— View job No issues found. 0 high, 0 medium, 0 low. Last round's only finding, Review details
What I checkedThese checks cover Tesseract only. The legacy planner doesn't match this
Review threadsThe listing returned no prior threads of mine (0). I resolved none and re-affirmed none. |
What was broken
PrimaryCubejoinsSecondaryCube(many_to_one, different data sources) and arollupJoincombinesPrimaryCube.primary_rollupwithSecondaryCube.main. A query withPrimaryCube.total_countandSecondaryCube.total_contract_valuebySecondaryCube.location_idmatched therollupJoin, but the SQL readsecondary_cube_main__usage_0, which was never loaded (relation "secondary_cube_main__usage_0" does not exist).Tesseract plans this query correctly: the
many_to_oneside's measure is computed fromSecondaryCube.mainon its own (usage 0), andPrimaryCube.total_countis read through therollupJoin(usage 1), whose legs includeSecondaryCube.mainagain. Each usage produced a description ofsecondary_cube_main, andpreAggregationsDescription()then deduplicated descriptions by table name, so only the__usage_1mapping survived.Fix
preAggregationDescriptionsForUsageInfosnow merges descriptions of the same table: the usage mappings are combined, so the orchestrator substitutes every__usage_Nname the SQL reads. When the descriptions carry different matched date ranges, the merged one spans both; if either reads all partitions, so does the merged one. Each usage keeps its owndateRangein the mapping.Interaction with #12577
#12577 suffixes the legs of a
rollupJoinscanned in a query with several usages; this PR builds on it. With both, the legs read__usage_1andsecondary_cube_main__usage_0is loaded as well, so the query executes end to end. #12577 alone does not fix it: the new test fails without this change.Fan-out
Summing a
one-side measure through the join does not happen: by the joined cube's own dimensions Tesseract reads its leg rollup alone, and by a dimension of themanyside the measure goes through a keys subquery that no rollup serves, so it does not match therollupJoinat all.Tests
pre-aggregations.test.ts: every table the SQL reads is declared bypreAggregationsDescription(), for a base-cube measure and for measures of both cubes (fails before the fix).pre-aggregationsunit suite, other unit suites asserting on descriptions, and the Postgrespre-agg*integration suites under Tesseract.The legacy planner does not match the
rollupJoinfor this model at all (a separate issue, covered by #12519).Fixes #11124
🤖 Generated with Claude Code