`ROLLUP`/`CUBE`/`GROUPING SETS`: an element starting with `(` is always read as a sublist (`(SELECT 1)` rejected, `((b))` displayed as `(b)`)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 52/100
Direzione di ricerca
Start with parse_group_by_expr in the parser, which calls parse_tuple(true, true) on each ROLLUP, CUBE and GROUPING SETS element, and with the Display code for Rollup and Cube in the AST. Reproduce the three queries from the issue under PostgreSqlDialect, including SELECT a FROM t GROUP BY ROLLUP (a, ((b))). Done means the (SELECT 1) cases parse and the ((b)) case round-trips without losing its nesting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Each element of ROLLUP, CUBE and GROUPING SETS treats a leading ( as its own sublist delimiter, which breaks parenthesized expressions:
SELECT a FROM t GROUP BY ROLLUP (a, (SELECT 1))
-> sql parser error: Expected: ), found: 1 at Line: 1, Column: 45
SELECT a FROM t GROUP BY CUBE (a, (SELECT 1))
SELECT a FROM t GROUP BY GROUPING SETS (a, (SELECT 1))
-> same error
SELECT a FROM t GROUP BY ROLLUP (a, ((b)))
-> displays as: SELECT a FROM t GROUP BY ROLLUP (a, (b))
-> reparses as ROLLUP (a, b): element [Nested(b)] becomes [b]
PostgreSQL 18 runs SELECT a FROM t GROUP BY ROLLUP (a, (SELECT 1)). Its docs: "The individual elements of a CUBE or ROLLUP clause may be either individual expressions, or sublists of elements in parentheses" (https://www.postgresql.org/docs/current/queries-table-expressions.html#QUERIES-GROUPING-SETS). The second case changes only the AST, since PostgreSQL treats ((b)) and (b) the same.
parse_group_by_expr parses each element with parse_tuple(true, true), which consumes the ( of (SELECT 1) and then reads SELECT as an identifier. Display for Rollup/Cube writes a one-element set without its own parentheses, so [Nested(b)] prints as (b).
Tested with PostgreSqlDialect on main ce12f1f6 (also 0.63.0 and 0.58.0).
Found with a property-based fuzzer (round trip check); I used AI assistance for triage and verified every case above.
- Lingua principale
- Rust
- Stelle
- 3.5k
- Fork
- 805
- Merge medio
- 2g 3h
- PR unite (30g)
- 116
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna 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 apache/datafusion-sqlparser-rs
-
PostgreSQL
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apache/datafusion-sqlparser-rs#2862 ·
I maintainer di solito rispondono entro 1 giorno
-
PostgreSQL
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/datafusion-sqlparser-rs#2861 ·
I maintainer di solito rispondono entro 1 giorno
-
PostgreSQL
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
apache/datafusion-sqlparser-rs#2858 ·
I maintainer di solito rispondono entro 1 giorno
-
PostgreSQL
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/datafusion-sqlparser-rs#2857 ·
I maintainer di solito rispondono entro 1 giorno
-
DuckDB Prolific Author
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
apache/datafusion-sqlparser-rs#2807 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/datafusion-sqlparser-rs
Issue simili
-
area:schema documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ElectronicWave/Elemental#252 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dekobon/big-code-analysis#1887 ·
I maintainer di solito rispondono entro 1 giorno
-
Shell中文符号输入异常Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno