-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
Describe the bug
When a multi_stage measure's sql references a raw column (no {} measure dependency), and another multi_stage measure references it via {}, the query throws:
Multi stage member 'cube.measure' lacks FROM clause in sub query
To Reproduce
cubes:
- name: orders
sql_table: orders
dimensions:
- name: id
sql: id
type: number
primary_key: true
- name: status
sql: status
type: string
measures:
- name: raw_sum
sql: amount
type: sum
multi_stage: true
- name: computed
sql: "{raw_sum}"
type: number
multi_stage: trueQuery orders.computed with any dimension — the leaf measure raw_sum causes the error.
Root cause
In renderWithQuery (BaseQuery.js), the leaf measure has no children in the member dependency graph, so memberFrom is null. This makes fromMeasures null → fromSubQuery null → fromSql null. The error check at the end of renderWithQuery then throws because subQuery.from is undefined.
Expected behavior
The query should build successfully, falling back to querying the cube's own table when fromSubQuery was never built.
Related
- Unexpected GROUP BY when using multi_stage and referencing dimensions with {} #9241 — different symptom (unexpected GROUP BY) in the same code path (
renderWithQuery), but different root cause (non-leaf case with{}references)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels