docs: exhaustively document the multi-stage grain directive#11073
Open
AvilaJulio wants to merge 1 commit into
Open
docs: exhaustively document the multi-stage grain directive#11073AvilaJulio wants to merge 1 commit into
AvilaJulio wants to merge 1 commit into
Conversation
72e1087 to
f3d0a93
Compare
f3d0a93 to
157a7e5
Compare
157a7e5 to
e0392d5
Compare
e0392d5 to
05405aa
Compare
05405aa to
391e1c2
Compare
391e1c2 to
da42aee
Compare
Expand the "Controlling grain" section of the measures guide with the per-key mechanics (keep_only / exclude / include) and worked result tables, verified against the multi-stage-grain integration test. On the measures reference, keep upstream's grain/legacy sections and add a note that `grain` requires the Tesseract SQL planner, is valid only on measures, and is distinct from the similarly-named keys on the `filter` directive. Add a new "Semi-additive (end-of-period) measures" recipe demonstrating grain (include + keep_only) and rank for end-of-period balances, and register it in the docs navigation.
da42aee to
0e38ebf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Documents the multi-stage
graindirective, which was previously undocumented despite being accepted by the schema validator and exercised by themulti-stage-grainintegration test.Reference (
reference/data-modeling/measures.mdx)### grainsection coveringkeep_only,exclude, andinclude, with worked result tables whose numbers are verified againstmulti-stage-grain.test.ts.grainas the canonical form ofgroup_by/reduce_by/add_group_by(which map tokeep_only/exclude/includerespectively).<Warning>that a measure uses either agrainblock or the legacy parameters — never both. This reflects the Tesseract planner (build_grain_from_legacy/from_measure_definition): when agrainblock is present, the legacy directives on that measure are ignored.grain's keys from the same-named keys on thefilterdirective.Concepts (
docs/data-modeling/measures.mdx)Recipe (
recipes/data-modeling/semi-additive-measures.mdx)rankplusgrain(includefor the leaf grain,keep_onlyfor the window partition).docs.json.Notes
CUBEJS_TESSERACT_SQL_PLANNER=trueis required forgrain; called out throughout.