prql
prql copied to clipboard
Grouping breaks `select * except`
What happened?
A small issue where if a select !{...}
is followed by a group
, the exclude (...)
bit goes missing from the SQL output. Regression since v0.10.1.
A workaround is to move the select
after the group
.
Encountered using bigquery but seems to be an issue in all dialects where SELECT * EXCLUDE
is otherwise supported.
PRQL input
prql target:sql.bigquery
from foo
select !{a, b}
group {c} (
sort {-d}
take 1
)
SQL output
WITH table_0 AS (
SELECT
*,
ROW_NUMBER() OVER (
PARTITION BY c
ORDER BY
d DESC
) AS _expr_0
FROM
foo
)
SELECT
*
EXCEPT
(_expr_0)
FROM
table_0
WHERE
_expr_0 <= 1
-- Generated by PRQL compiler version:0.11.1 (https://prql-lang.org)
Expected SQL output
WITH table_0 AS (
SELECT
*,
ROW_NUMBER() OVER (
PARTITION BY c
ORDER BY
d DESC
) AS _expr_0
FROM
foo
)
SELECT
*
EXCEPT
(_expr_0, a, b)
FROM
table_0
WHERE
_expr_0 <= 1
-- Generated by PRQL compiler version:0.11.1 (https://prql-lang.org)
MVCE confirmation
- [X] Minimal example
- [X] New issue
Anything else?
No response
Agree, thanks for the report @syko
Introduced by https://github.com/PRQL/prql/pull/3826