-
Notifications
You must be signed in to change notification settings - Fork 250
Closed
Labels
bugInvalid compiler output or panicInvalid compiler output or panic
Description
What happened?
PRQL compiler version:0.9.2
This issue is similar to an existing one, #2680. But I'm not sure if the root causes of those two issues are the same. So I open a new one.
I found that the aggregate clause also affects the translation of the append clause.
In the following example, assuming tb1 and tb2 have the same columns, we append tb2 to tb1, and get the minimum c0. But in the SQL code, it selects the target column before the union operation. Then the union operation fails.
error message from the database: "each UNION query must have the same number of columns"
PRQL input
from tb1
append tb2
aggregate {new_col1 = min c0}SQL output
WITH table_0 AS (
SELECT
c0
FROM
tb1
UNION
ALL
SELECT
*
FROM
tb2
)
SELECT
MIN(c0) AS new_col1
FROM
table_0
-- Generated by PRQL compiler version:0.9.2 (https://prql-lang.org)Expected SQL output
WITH table_0 AS (
SELECT
c0
FROM
tb1
UNION
ALL
SELECT
c0
FROM
tb2
)
SELECT
MIN(c0) AS new_col1
FROM
table_0MVCE confirmation
- Minimal example
- New issue
Anything else?
No response
Metadata
Metadata
Assignees
Labels
bugInvalid compiler output or panicInvalid compiler output or panic