malloy
malloy copied to clipboard
Compilation error when using nested queries with `declare`
I have a query in a source that uses the declare
keyword (sales_summary
), and I'm trying to run the query on unaggregated data, and then re-use it in a nest, e.g.,:
query: sales_summary_by_dept is sales_summary + {
nest: by_dept is sales_summary + {
group_by: inventory_items.product.department
}
}
This should give me the overall results of sales_summary
, and also the results of sales_summary
by department.
Instead, I'm getting:
line 257: INTERNAL ERROR model/Segment.nextStructDef: Redefinition of total_sales_2022
If I re-write the query so it doesn't use the declare
keyword and instead just duplicate all the aggregation code, or if I define the measure on the Source, it works fine. See this example query in GitHub.
does this break in the world of extend: {
instead of declare: