apache / apache/datafusion-sqlparser-rs
formatting the AST while preserving the source location information from the original query
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 772
- 平均合并
- 4 天 9 小时
- 30 天内合并 PR
- 17
描述
In the current sqlparser, parsing
```sql
select
a,
b
from
t
```
and then fromatting it back to a string results in
```sql
select a,b from t
```
Since sqlparser v0.53, we have the source location information inside the AST, which theoretically makes it possible to reconstruct the original query formatting (or at least getting very close to it).
I know this is a huge undertaking, but it would be really useful. For instance, in [sqlpage](https://github.com/lovasoa/SQLpage), I would love being able to respect the initial user formatting of queries, in order for database errors that contain source position information to be meaningful and not confusing.
I'm opening this issue to start discussing this with the community (and especially with you @iffyio and @alamb :wink: ).
Am I the only one interested in this ? What would be the best approach to implementing this ?
贡献指南
这个仓库没有索引到贡献指南
调研方向
未指定具体的文件或测试。首先检查 sqlparser v0.53 中引入的 AST 源位置支持以及现有的格式化路径;当能够足够准确地重建原始查询的格式,使源位置仍然具有意义时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust, sql
- 领域
- compilers
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100