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: true
Query 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
Describe the bug
When a
multi_stagemeasure'ssqlreferences a raw column (no{}measure dependency), and anothermulti_stagemeasure references it via{}, the query throws:To Reproduce
Query
orders.computedwith any dimension — the leaf measureraw_sumcauses the error.Root cause
In
renderWithQuery(BaseQuery.js), the leaf measure has no children in the member dependency graph, somemberFromis null. This makesfromMeasuresnull →fromSubQuerynull →fromSqlnull. The error check at the end ofrenderWithQuerythen throws becausesubQuery.fromis undefined.Expected behavior
The query should build successfully, falling back to querying the cube's own table when
fromSubQuerywas never built.Related
renderWithQuery), but different root cause (non-leaf case with{}references)