Commit 8dbd2a8
A dataset selection whose base measures ALL carry their own measure-scoped
`filter` (or whose selected derived measures depend only on such measures)
never issues the primary grouped query: `runMeasurePass` starts from a
synthesized `{ rows: [], fields: [] }` and each supplementary sub-query appends
exactly one MEASURE descriptor. The dimension columns are in every row — they
are the merge key — but described nowhere, so a consumer reading column
metadata had no `label` and no `type` for the grouped column and fell back to
humanizing the raw key: "owner" where the dataset declares "Owner".
The dimension descriptors are now adopted from the FIRST supplementary result,
which projects exactly the dimensions the pass groups by. Taken from the
sub-result rather than re-derived from `compiled.cube`: the projected set is
defined by each strategy's `buildFieldMeta` (#4033), so an executor-side
reconstruction would be a fourth copy of that rule, free to drift from the rows
it labels. Reading it back makes the two paths converge by construction — on
order (dimensions first), on `type`, and on whatever the active strategy
projected. `compareTo`, `totals` and derived measures all route through the
same pass, so all three are covered.
The label enrichment in `queryDataset` is left enriching-only, with a note
saying why: whether a column exists is the query layer's answer, and minting
one there would describe a column the rows may not carry.
Tests: `dataset-dimension-field-descriptors.test.ts` asserts the complete
`fields` set and order (exact `toEqual`, full descriptor) for the healthy
single-query path and for every all-filtered shape. Reverse verification —
direction predicted first — reverting the executor seam turns the 8
all-filtered cases red and leaves the 4 convergence-target cases green;
measured exactly that.
Out of scope, filed as #5688: a `timeDimensions` entry carrying only a
`dateRange` acquires the dataset's default granularity, turning a WINDOW into a
second GROUP BY. Reproduces identically on the path this fix never touched;
pinned here as data (row count included) so #5688 landing goes red on purpose.
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 39e43c8 commit 8dbd2a8
4 files changed
Lines changed: 499 additions & 3 deletions
File tree
- .changeset
- packages/services/service-analytics/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
0 commit comments