Relation literal rows are matched to columns by position, so rows with different field names or order produce wrong data
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 70/100
Direzione di ricerca
Start at prqlc/prqlc/src/semantic/lowering.rs L377-L414, where pl::ExprKind::Array is lowered into RelationLiteral.columns: columns come from the first row's lineage, and later rows' tuple values are copied in position, ignoring field names. First settle with the maintainers the open design question — reorder each row by name, or reject mismatched rows — plus the rule for unnamed fields like {1, 2}; coordinate with open PR #6413, which edits the same block. Done means from [{a=1, b=2}, {b=3, a=4}] compiles to SQL preserving names, and the other two example shapes either reorder or fail cleanly as decided.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A relation literal takes its column names from the first row only. Every later row is matched to those columns by position, ignoring its own field names. Queries whose rows disagree compile without error and produce wrong data.
from [{a=1, b=2}, {b=3, a=4}]
compiles (at c945ca81) to
WITH
table_0 AS (
SELECT
1 AS a,
2 AS b
UNION ALL
SELECT
3 AS a,
4 AS b
)
SELECT
a,
b
FROM
table_0
So the second row comes back as a=3, b=4 rather than a=4, b=3. Two related shapes go wrong the same way:
from [{a=1}, {b=2}]yields one columnawith values1, 2. The second row'sbis renamed toa.from [{a=1}, {a=2, b=3}]yields only columna. The second row'sb=3is dropped.
The lowering of pl::ExprKind::Array builds RelationLiteral.columns from the expression's lineage, then copies each row's tuple values in order without looking at their names (lowering.rs).
There are two plausible fixes: reorder each row's fields to match the first row's columns by name, or reject rows whose field names differ from the first row's with a compile error. Either way, unnamed fields ({1, 2}) need a rule too: whether they stay positional, and whether mixing named and unnamed fields is allowed. Open PR #6413 changes the same block (it reports malformed rows instead of panicking), so a fix here will probably build on it.
A review of #6413 first spotted this; it isn't caused by that PR.
- 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 1 giorno fa. 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 72/100
DioxusLabs/blitz#1371 ·
I maintainer di solito rispondono entro 1 giorno
-
follow-up
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
carrick-sh/carrick#1494 ·
I maintainer di solito rispondono entro 1 giorno
-
test(hydro_std): track_membership join and leave are untestedForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
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 ·