Column reference error for `loop` inside functions
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start by running the supplied PRQL input as an MVCE and compare its generated SQL with the expected output. Trace the compiler path for loop expressions inside functions, focusing on column names and the recursive join condition. Done means the example compiles with the expected column references and join predicate, with a regression test covering it.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happened?
There's a regression in PRQL version:0.12.2 in that some loop examples no longer compile correctly.
The problems are:
- References to
_expr_0,_expr_1,_expr_2,_expr_3, and_expr_4instead oft,x, andewma, - Recursive reference to
table_2.tin) AS table_5 ON table_5.t = table_5.t + 1.
The expected output runs correctly in shell.duckdb.org.
PRQL input
let calc_ewma = func span rel -> (
from rel
filter t==1
select {t, x, ewma=x}
loop (
join rel (that.t==this.t+1)
select {t, x, ewma = 2/(span+1)*x + (1-2/(span+1))*ewma}
)
)
let data = [
{ts=1, value=1},
{ts=2, value=12},
{ts=3, value=13},
{ts=4, value=5},
{ts=5, value=1},
]
from data
select {t=ts, x=value}
calc_ewma 3
select {ts=t, value=x, value_ewma3=ewma}
SQL output
WITH RECURSIVE table_0 AS (
SELECT
1 AS ts,
1 AS value
UNION
ALL
SELECT
2 AS ts,
12 AS value
UNION
ALL
SELECT
3 AS ts,
13 AS value
UNION
ALL
SELECT
4 AS ts,
5 AS value
UNION
ALL
SELECT
5 AS ts,
1 AS value
),
data AS (
SELECT
ts,
value
FROM
table_0
),
table_3 AS (
SELECT
ts AS t,
value AS x
FROM
data
),
table_2 AS (
SELECT
_expr_0,
_expr_1,
_expr_1 AS _expr_2
FROM
table_3
WHERE
_expr_0 = 1
UNION
ALL
SELECT
table_5.t AS _expr_3,
table_5.x AS _expr_4,
2 / (3 + 1) * table_5.x + (1 - 2 / (3 + 1)) * table_2._expr_2
FROM
table_2
JOIN (
SELECT
ts AS t,
value AS x
FROM
data
) AS table_5 ON table_5.t = table_5.t + 1
)
SELECT
t AS ts,
x AS value,
_expr_2 AS value_ewma3
FROM
table_2 AS table_4
-- Generated by PRQL compiler version:0.12.2 (https://prql-lang.org)
Expected SQL output
WITH RECURSIVE table_0 AS (
SELECT
1 AS ts,
1 AS value
UNION
ALL
SELECT
2 AS ts,
12 AS value
UNION
ALL
SELECT
3 AS ts,
13 AS value
UNION
ALL
SELECT
4 AS ts,
5 AS value
UNION
ALL
SELECT
5 AS ts,
1 AS value
),
data AS (
SELECT
ts,
value
FROM
table_0
),
table_3 AS (
SELECT
ts AS t,
value AS x
FROM
data
),
table_2 AS (
SELECT
t,
x,
x AS ewma
FROM
table_3
WHERE
t = 1
UNION
ALL
SELECT
table_5.t,
table_5.x,
2 / (3 + 1) * table_5.x + (1 - 2 / (3 + 1)) * table_2.ewma as ewma
FROM
table_2
JOIN (
SELECT
ts AS t,
value AS x
FROM
data
) AS table_5 ON table_5.t = table_2.t + 1
)
SELECT
t AS ts,
x AS value,
ewma AS value_ewma3
FROM
table_2 AS table_4
MVCE confirmation
- Minimal example
- New issue
Anything else?
This might have been introduced in version 0.10 or 0.11 already as I noticed my examples failing to compile then. I've just been pinning to 0.9.5 since then.
- Lingua principale
- Rust
- Stelle
- 10.9k
- Fork
- 261
- Merge medio
- 3g 21h
- PR unite (30g)
- 84
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PRQL/prql
-
Underscore does not work as expectedForse già presa @prql-bot l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 3 giorni
-
prqlc Debug Report HTML Does Not Escape Source File Name, Enabling Stored XSS via PRQLC_DEBUG_LOGApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 3 giorni
-
Add `.prql` to linguistApertafriendliness integrations
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
PRQL/prql#1636 · 2 commenti · 2 reazioni ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 4/5 1-2 giorni Idoneità per principianti 12/100
I maintainer di solito rispondono entro 3 giorni
-
review-runs-tracking
Difficoltà 3/5 Mezza giornata Idoneità per principianti 5/100
I maintainer di solito rispondono entro 3 giorni
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
hydro-project/hydro#3289 ·
I maintainer di solito rispondono entro 1 giorno
-
diagram-bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
enhapu-afk/omaspec#4 ·
-
priority: low ☕️ type: bug 🐛
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
bug security
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 4 giorni