Commit dacea17
committed
fix(analytics): a dataset measure's result type stops contradicting its own value
Every producer of `AnalyticsResult.fields` minted `{ name, type: 'number' }`
for a measure — both strategies' `buildFieldMeta`, the draft-preview evaluator,
and `DatasetExecutor.runMeasurePass`'s supplementary / compare / derived
appends. That is right for most of the closed `AggregationFunction` vocabulary
and wrong for `min`/`max` over a `date`/`datetime`/`time` field, which return a
value OF THE AGGREGATED FIELD'S OWN TYPE: the response then carried an ISO
instant and a `type: "number"` describing it, in one line.
The measure column's type is now resolved in `queryDataset`'s ADR-0021
result-column enrichment — the block that already resolves `label` / `format` /
`currency` / `percentScale` from the authored measure plus `sourceFieldMeta`,
and the one seam every producer passes through on the way to a route that
relays the return verbatim. The rule itself lives in `measure-result-type.ts`
so the per-aggregate verdict has one home rather than four copies.
The corrected spelling is `time`, the `DimensionType` word a temporal DIMENSION
column in the same response has always carried; a second temporal word in one
wire position would leave every existing consumer branch unreached.
Only `min`/`max` move. `count`/`count_distinct` are numeric however temporal
the column they read is; `sum`/`avg` over a temporal column are refused by no
layer and answered by the backend, so no type is invented for them; a derived
measure is numeric by construction. Tiered "cannot answer, do not block": a
host with no source-field metadata, and a measure over a relationship path,
leave the column exactly as produced. Row values are untouched on every path.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XpTx2tbq3pZRYAdoGt6E6Y1 parent c252041 commit dacea17
6 files changed
Lines changed: 546 additions & 1 deletion
File tree
- .changeset
- packages
- services/service-analytics/src
- __tests__
- spec/src
- api
- contracts
| 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 | + | |
0 commit comments