prql
prql copied to clipboard
`join` inside a `group` clause causes panic
What happened?
I wrote a query that should select all companies with more than one addreses, and list all addresses except the most recent one.
However, I get a compiler panic on the playground.
PRQL input
from c = companies
join ca = companies_addresses(c.tax_code == ca.company)
group c.tax_code (
join a = addresses(a.id == ca.address)
sort {-ca.created_at}
take 2..
)
sort tax_code
SQL output
A compiler bug was encountered. Please copy/paste the PRQL query into a new report at:
https://github.com/PRQL/prql/issues/new?template=bug_report.yaml
Expected SQL output
(I have no idea how to write this query in SQL)
MVCE confirmation
- [x] Minimal example
- [x] New issue
Anything else?
It may be related to https://github.com/PRQL/prql/issues/3870
The application panicked (crashed). Message: called
Option::unwrap()on aNonevalue Location: prqlc/prqlc/src/semantic/module.rs:258
https://github.com/PRQL/prql/blob/be0f2da98391b50b3a1f4881b8fb77854b3e0a03/prqlc/prqlc/src/semantic/module.rs#L256-L258