apache / apache/datafusion-sqlparser-rs

formatting the AST while preserving the source location information from the original query

未關閉
#1,634 8 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Rust
星號
3.5k
分支
774
平均合併
4 天 9 小時
30 天內合併 PR
17

描述

In the current sqlparser, parsing

select
  a,
  b
from
  t

and then fromatting it back to a string results in

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, 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 😉 ).

Am I the only one interested in this ? What would be the best approach to implementing this ?

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

未指定特定的檔案或測試。先檢查 sqlparser v0.53 中引入的 AST 原始碼位置支援,以及現有的格式化路徑;當能夠足夠精確地重建原始查詢的格式,使原始碼位置仍然具有意義時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
rust, sql
領域
compilers
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。