apache / apache/datafusion-sqlparser-rs
formatting the AST while preserving the source location information from the original query
- 主要言語
- Rust
- スター
- 3.5k
- フォーク
- 772
- 平均マージ
- 4日 9時間
- マージ済み PR(30日)
- 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
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100