apache / apache/datafusion-sqlparser-rs
Allow the possibility to optionnaly add "AS" in the From clause for CustomDialect
- Vorherrschende Sprache
- Rust
- Sterne
- 3.5k
- Forks
- 772
- Ø Merge
- 4 T. 9 Std.
- Gemergte PRs (30 T.)
- 17
Beschreibung
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
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne in src/ast/query.rs ungefähr bei Zeile 662 und verfolge, wie Tabellenaliase für CustomDialect gerendert werden. Prüfe die nahegelegenen Dialekt- und Rendering-Tests und verifiziere anschließend, dass ein benutzerdefinierter Dialekt AS in FROM-Aliasen auslassen kann, während das Verhalten bestehender Dialekte unverändert bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust, sql
- Bereich
- databases
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100