apache / apache/datafusion-sqlparser-rs

Allow the possibility to optionnaly add "AS" in the From clause for CustomDialect

Aperta
#1,784 2 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

Some dialect like Oracle do not support "AS" in the from clause and failed for some query :

eg that is working or Oracle :
```sql
SELECT SRC.*, SYSDATE AS CopyDate FROM TPCH_IN.ORDERS_FLAT SRC WHERE 1 = 1 AND O_ORDERKEY BETWEEN 100 and 1000
```
whereas this is not working (on Oracle)
```sql
SELECT SRC.*, SYSDATE AS CopyDate FROM TPCH_IN.ORDERS_FLAT AS SRC WHERE 1 = 1 AND O_ORDERKEY BETWEEN 100 and 1000
```

Currently the sqlparser force the addition of the keyword AS between the table and it's alias even the original query does not contains "AS" in its from clause.

I don't see the ability to create a custom dialect to avoid this behavior.

I am not sure but i think the "problem" could be here :
https://github.com/apache/datafusion-sqlparser-rs/blob/62495f2f0d998690495f111063a0b0a3466ffa69/src/ast/query.rs#L662

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia in src/ast/query.rs intorno alla riga 662 e segui come vengono renderizzati gli alias delle tabelle per CustomDialect. Controlla i test vicini relativi ai dialetti e al rendering, quindi verifica che un dialetto personalizzato possa omettere AS negli alias di FROM, lasciando invariato il comportamento dei dialetti esistenti.

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

Valutazione

Stack tecnologico
rust, sql
Ambito
databases
Tipo di issue
Funzionalità
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.