apache / apache/datafusion-sqlparser-rs
Allow the possibility to optionnaly add "AS" in the From clause for CustomDialect
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 772
- 平均合并
- 4 天 9 小时
- 30 天内合并 PR
- 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