`ROLLUP`/`CUBE`/`GROUPING SETS`: an element starting with `(` is always read as a sublist (`(SELECT 1)` rejected, `((b))` displayed as `(b)`)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- Meio dia
- Facilidade para iniciantes
- 52/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Rust
- Estrelas
- 3.5k
- Forks
- 805
- Merge médio
- 2d 3h
- PRs com merge (30d)
- 116
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de apache/datafusion-sqlparser-rs
-
PostgreSQL
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
apache/datafusion-sqlparser-rs#2862 ·
Mantenedores costumam responder em até 1 dia
-
PostgreSQL
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
apache/datafusion-sqlparser-rs#2861 ·
Mantenedores costumam responder em até 1 dia
-
PostgreSQL
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
apache/datafusion-sqlparser-rs#2858 ·
Mantenedores costumam responder em até 1 dia
-
PostgreSQL
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
apache/datafusion-sqlparser-rs#2857 ·
Mantenedores costumam responder em até 1 dia
-
DuckDB Prolific Author
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
apache/datafusion-sqlparser-rs#2807 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de apache/datafusion-sqlparser-rs
Issues semelhantes
-
area:schema documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
ElectronicWave/Elemental#252 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
dekobon/big-code-analysis#1887 ·
Mantenedores costumam responder em até 1 dia
-
Shell中文符号输入异常Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia