apache / apache/datafusion-sqlparser-rs

Can't parse valid Snowflake compound expression

Aperta
#1,833 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
3.5k
Fork
772
Merge medio
4g 9h
PR unite (30g)
17

Descrizione

Hey there, thanks for the great project!

I'm encountering an issue with the following query, which is valid in Snowflake:

```sql
SELECT v.$2 FROM (VALUES (1, 'value1'), (2, 'value2')) AS v
```

It can't get parsed with sqlparser-rs:

```
Expected: an identifier or a '*' after '.', found: $2 at Line: 1, Column: 10
```

While this syntax isn't valid in PostgreSQL, it is accepted by Snowflake. `SELECT $2 FROM ...` (without the alias) parses correctly, so it seems the parser has trouble with positional parameters when they're part of compound expressions.

Is this a gap in the Snowflake dialect implementation?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia riproducendo la query Snowflake `SELECT v.$2 FROM (VALUES (1, 'value1'), (2, 'value2')) AS v` nella gestione del dialetto Snowflake del parser. Traccia il modo in cui le espressioni composte elaborano il parametro posizionale `$2` dopo un alias. Il lavoro è completato quando questa espressione Snowflake valida viene analizzata correttamente senza introdurre regressioni nel caso esistente `SELECT $2 FROM ...`.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust, sql
Ambito
databases
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.