malloy
malloy copied to clipboard
Unchecked partition_by produces runtime error
run: duckdb.sql("""
SELECT 'n' as name, 1 as filed, 'val1' as sic
UNION ALL SELECT 'n', 2, 'val1'
UNION ALL SELECT 'n', 3, 'val2'
UNION ALL SELECT 'n', 4, 'val3'
""") -> {
group_by: sic
calculate: lag_sic is lag(sic)
group_by: filed
calculate: change_in_sic is
pick 'Initial' when lag(sic) = NULL
pick 'True' when sic != lag(sic) {partition_by: name order_by: filed}
else 'No Change'
order_by: filed
}
Produces a runtime error "Internal Error, field Not defined name"
Change group_by: filed
to group_by: filed. name
and it works
If I leave filed
out of the group_by:
I get Unknown field filed in output space
from the compiler
- We should check the
partition_by:
like we do theorder_by:
at compile time - The error message could be more helpful, and it should at least be
Unknown field 'filed' in output space