apache / apache/datafusion-sqlparser-rs
Allow the possibility to optionnaly add "AS" in the From clause for CustomDialect
- 主要言語
- Rust
- スター
- 3.5k
- フォーク
- 772
- 平均マージ
- 4日 9時間
- マージ済み PR(30日)
- 17
説明
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
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
src/ast/query.rs の 662 行目付近から始め、CustomDialect でテーブルエイリアスがどのようにレンダリングされるかを追跡します。近くにあるダイアレクトおよびレンダリングのテストを確認し、既存のダイアレクトの動作を変更せずに、カスタムダイアレクトで FROM エイリアスの AS を省略できることを検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust, sql
- 領域
- databases
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100