Commit 6439f8b
fix(service-analytics): compile a measure's field and filter, on both doors (#10411)
* fix(service-analytics): compile a measure's field and filter, on both doors
A dataset measure declares `aggregate`, `field` and `filter`; the compiled SQL
used only `aggregate`.
1. `{ aggregate: 'count', field: 'x' }` emitted `COUNT(*)`. The wrapper table
took the resolved column and discarded it, so a measure asking how many rows
carry a value counted every row it was handed.
2. `/api/v1/analytics/query` dropped every per-measure `filter`, and the
dataset's definition-level `filter` with it. That door addresses the
registered Cube directly; both filters live beside the cube in the dataset
registry, and only `DatasetExecutor` — the dashboard's door — ever read them.
One cube and one set of measure names answered two different numbers
depending on which door the caller came in.
`count` now takes its column (`*` still counts rows — it is the compiler's "no
field declared" spelling), and a new conditional-aggregate table lowers a
measure filter to a portable `CASE WHEN` (not `FILTER (WHERE …)`, which MySQL
lacks). The dataset scope reaches the strategy through `getDatasetScope` on the
context the analytics package builds for its own strategies — same shape and
same registry as the neighbouring `getAllowedRelationships`, and no spec edit.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx
* test(service-analytics): group the two-door agreement on a column the filters do not name
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx
* chore(changeset): state the figures that move for an operator
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 6276651 commit 6439f8b
6 files changed
Lines changed: 579 additions & 7 deletions
File tree
- .changeset
- packages/services/service-analytics/src
- __tests__
- strategies
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments