malloydata / malloy

Malloy is an experimental language for describing data relationships and transformations.
http://www.malloydata.dev
MIT License
1.96k stars 76 forks source link

SQL compilation error on DuckDB when using `nest` and `having` clauses #975

Open carlineng opened 1 year ago

carlineng commented 1 year ago

This is on DuckDB v0.6.1 and Malloy v0.2.1670328727

The query in this fiddle fails with a SQL compilation error:

Parser Error: syntax error at or near ")"
LINE 324: ..._0."i_brand_id" as "i_brand_id",

Line 324 looks like it has an empty partition by clause:

, __stage4 AS (
  SELECT
    *,
    MAX(CASE WHEN group_set IN (0,1,2,3,4) THEN __delete__0 END) OVER(partition by ) as __shaving__0 
  FROM __stage3)

It looks like removing either the having clause, or the nest clauses gets the query to work (see fiddle)

carlineng commented 1 year ago

Adding a link to VSCode.dev to reproduce this issue (super cool that this is possible now!!)