docs: pre-aggregation matching for switch dimensions (follow-up to #11346) - #11441
docs: pre-aggregation matching for switch dimensions (follow-up to #11346)#11441igorlukanin wants to merge 4 commits into
Conversation
|
Claude finished @igorlukanin's task in 5m 49s —— View job Review: 1 high, 2 medium, 2 low — core claims verified against the planner, one rollup example is a no-opThe central claim of the PR is correct and well-grounded: Full review — findings, verification notes, checklistChecklist
What I verified in source
Anchors all resolve: Findings
Nice work
|
…ove the all-or-nothing caveat to multi-fact matching
|
Claude finished @igorlukanin's task in 5m 43s —— View job Re-review of
|
| Finding | Status |
|---|---|
inDateRange overstated as "prevents matching" |
✅ now mirrors query-format.mdx — "applied as a generic dimension filter … matches only when that time dimension is also listed in the pre-aggregation's dimensions" |
Recipe conflated a SQL-API WHERE with timeDimensions |
✅ scoped to "When querying through the REST (JSON) API" |
| All-or-nothing caveat filed under switch dimensions | ✅ moved to "Matching multi-fact and multi-stage queries", where a reader debugging a dropped rollup lands; the time-dimension-keying cause reads well there |
values described as an alternative to sql |
✅ "Requires a values sub-parameter and doesn't accept sql" matches SwitchDimension in CubeValidator.ts:1011-1014 (min(1).required(), no sql key) |
rolling_window example dimension name collided with the measure parameter |
✅ renamed to growth_window, consistent with the recipe |
The one suggestion not taken — hoisting the values explanation out of the table cell into its own ### section — was stylistic; the trimmed cell reads fine.
All five of my earlier threads are resolved: two withdrawn as incorrect, three addressed by the commit. Docs-only change; no security, performance, or test-coverage concerns.
|
Claude finished @igorlukanin's task in 3m 10s —— View job Re-review of
|
| # | Location | Issue |
|---|---|---|
| 1 | matching-pre-aggregations.mdx:173-181 |
The reworded inDateRange note is accurate but sits at the end of "Matching switch dimensions" while being general time-dimension guidance. ### Matching time dimensions (lines 65-88) is where a reader who lost a rollup to inDateRange will look, and it doesn't mention it. Same misfiling you fixed for the all-or-nothing caveat in 40cba45. |
| 2 | dynamic-rolling-windows.mdx:449 |
Now the only computed-CUBE[...] pre-agg measures list in the docs; every other JS example uses bare identifiers. One sentence on why strings don't work would save the next person the silent no-match. |
| 3 | dimensions.mdx:930 |
"doesn't accept sql" understates it — SwitchDimension (CubeValidator.ts:1011-1014) is a closed object with only type + values, so title/description/public/meta are rejected as well. Source-read only; dist/ isn't built here, so worth confirming before rewording. |
Threads
My last open thread (the JS string-names finding) is resolved — fixed by this commit. All six of my threads on this PR are now closed: two withdrawn as wrong, four addressed.
Docs-only change; no security, performance, or test-coverage concerns.
…n the CUBE[...] rollup refs
|
Claude finished @igorlukanin's task in 1m 20s —— View job Re-review of
|
| Item | Status |
|---|---|
inDateRange note misfiled under "Matching switch dimensions" |
✅ moved to the end of ### Matching time dimensions (matching-pre-aggregations.mdx:95-103), right after the custom-granularity paragraph. "the granularity matching rules above don't apply to it" now has real referents — the three bullets immediately preceding it. The recipe keeps its own in-context copy, which is the right split. |
CUBE[...] refs unexplained in the recipe |
✅ dynamic-rolling-windows.mdx:422-425 — "Cube resolves member references by recording them as they're accessed, so a string never registers as one — the rollup compiles with an empty measure list and silently matches nothing." That's the mechanism (symbolPaths populated by the proxy's get trap), stated in one sentence without dragging the reader into internals, and it names the failure mode that makes it dangerous: silent. |
switch constraint understated |
✅ "Takes only a values sub-parameter — no sql, and no other parameters such as title or public" matches SwitchDimension in CubeValidator.ts:1011-1014 — a closed two-key object that DimensionsSchema routes to instead of the BaseDimension alternatives. Your compile check confirms what the source reading suggested. |
Regression checks on this commit
- All eight link definitions used by the moved/edited prose resolve:
ref-time-dimensions-format→query-format#time-dimensions-format,ref-in-date-range→#indaterange, plusref-switch,ref-case,ref-rollup,ref-multi-stage,ref-matching-switch-dimensions,link-tesseract. - Removing the
<Note>leaves "Matching switch dimensions" ending on the multi-cube modelling paragraph, which is the section's own subject — no dangling transition. - The recipe's new paragraph sits before the
<CodeGroup>and is scoped to "In the JavaScript model", so it doesn't read as a caveat on the YAML variant, which is unaffected. - JS/YAML parity holds on all three pages; the switch-section snippet still uses bare identifiers (
measures: [total, r3_amount, ytd_amount]), which is correct — bare identifiers transpile to recorded member refs, so no contradiction with the recipe's string-vs-CUBE[...]note. growth_windowexample indimensions.mdx:964/1004matches the recipe's naming.
Threads
The three that remained open are now resolved. Across the PR, all nine of my threads are closed: two withdrawn as incorrect (the measure-matcher findings — new_unrolling() keeps compiled_path, so the per-window measures do have to be listed), seven addressed by commits.
Docs-only change; no security, performance, or test-coverage concerns. Nothing blocking.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Summary
Pre-aggregations can match queries that use
switchdimensions without storing them, but nothing in the docs covered the interaction —switch/calc-group dimensions had zero mentions on the pre-aggregation pages.docs/pre-aggregations/matching-pre-aggregations.mdx— new### Matching switch dimensionssection: a rollup doesn't need to include aswitchdimension (and stays smaller for leaving it out), plus the two modeling constraints that apply whencasemeasures span cubes — define theswitchon one shared cube, and key every rollup on the time dimension the query groups by. Also qualifies the "contains all dimensions" matching bullet, which was stated twice and is now stated once.reference/data-modeling/dimensions.mdx—switchwas the only dimension type without a code example; added one to both variants of thetype<CodeGroup>, and documented thevaluessub-parameter.recipes/data-modeling/dynamic-rolling-windows.mdx— new## Pre-aggregationssection; the recipe had no rollup example, and its "always include theswitchdimension in the query" note is where the rollup question arises.Test plan
prepareYamlCompiler/prepareJsCompiler. The JS rollup in the recipe needed string member names — bareCUBE[...]references don't resolve inside a transpiledmeasuresarray.mint broken-links --check-anchors: zero failures in the touched pages; the 16 reported are pre-existing inembedding/iframe/.mint dev.