apache / apache/datafusion-sqlparser-rs
Always wrap statement in a named struct
- 主要語言
- Rust
- 星號
- 3.5k
- 分支
- 774
- 平均合併
- 4 天 9 小時
- 30 天內合併 PR
- 17
描述
In [GreptimeDB](https://github.com/GreptimeTeam/greptimedb/blob/v0.7.1/src/sql/src/statements/delete.rs), we write code like:
```rust
#[derive(Debug, Clone, PartialEq, Eq, Visit, VisitMut)]
pub struct Delete {
// Can only be sqlparser::ast::Statement::Delete variant
pub inner: Statement,
}
```
It's because in sqlparser-rs, these statement variants are unnamed struct:
```rust
Delete {
/// Multi tables delete are supported in mysql
tables: Vec,
/// FROM
from: Vec,
/// USING (Snowflake, Postgres, MySQL)
using: Option>,
/// WHERE
selection: Option,
/// RETURNING
returning: Option>,
},
```
I wonder if we can always wrap statement in a named struct so that downstream software can reuse the AST and impls (like for Display) more smoothly.
I don't know if it's a breaking change or we're generally OK with this.
Ref - https://github.com/GreptimeTeam/greptimedb/issues/3646
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
先檢視 sqlparser AST 中的 statement 定義,以及 GreptimeDB 的 src/sql/src/statements/delete.rs 中所示的下游 wrapper。檢查下游程式碼如何實作或使用 Display 與其他 AST trait,接著判斷包裝每個 statement variant 對相容性的影響。當有一份已記錄的設計或已接受的實作計畫,處理重用與 breaking change 方面的考量時,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust, sql
- 領域
- compilers
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100