Input containing rename, sort, filter, join results in output ORDER BY referring to wrong table #5097
Open
2 tasks done
Labels
bug
Invalid compiler output or panic
What happened?
A user built a seemingly simple PRQL query that performs the following operations, in this order:
select
The output SQL, when passed to DuckDB, produces:
The relevant part of the output SQL is:
Note that the
ORDER BY
referencestable_1
, which is referenced in theWITH
clause but not in the finalSELECT
statement.If you change the order or remove any of the steps, the generated output is correct. In particular, if you toggle the order of the
sort
andfilter
so thatfilter
precedessort
, the output is correct.The PRQL input below, when put into the Playground, will reproduce the error (click the Query Results tab).
PRQL input
SQL output
Expected SQL output
MVCE confirmation
Anything else?
No response
The text was updated successfully, but these errors were encountered: