apache / apache/datafusion-sqlparser-rs
Suggest splitting `parser.rs` into smaller mod files
- 主要語言
- Rust
- 星號
- 3.5k
- 分支
- 772
- 平均合併
- 4 天 9 小時
- 30 天內合併 PR
- 17
描述
# Background
The code of current `parser.rs` is too large, it's difficult to read and maintain. I'd suggest splitting it into smaller mod files.
# Proposal
I have split the `ALTER ROLE` code into `parser/alter.rs` in this PR [feat: add `ALTER ROLE` syntax of PostgreSQL and MS SQL Server by r4ntix · Pull Request #942 · sqlparser-rs/sqlparser-rs (github.com)](https://github.com/sqlparser-rs/sqlparser-rs/pull/942)
I think we can do a refactoring and split the parser, like this:
```shell
./src/parser/
|-- alter.rs
|-- create.rs
|-- drop.rs
|-- mod.rs
|-- select.rs
|-- ...
`-- utils.rs
```
I wonder what people would suggest about this?
# Implementation Plan
we can break it up into some issues and PRs to step through this refactoring.
## DDL
all tasks:
- [ ] ANALYZE
- [ ] ALTER
- [ ] CREATE
- [ ] DECLARE
- [ ] DROP
- [ ] UPDATE
- [ ] TRUNCATE
## DML
all tasks:
- [ ] DELETE
- [ ] EXPLAIN
- [ ] FETCH
- [ ] INSERT
- [ ] SELECT
- [ ] UPDATE
- [ ] MERGE
- [ ] MSCK
- [ ] ROLLBACK
- [ ] SET
- [ ] START
- [ ] TRUNCATE
## DCL
all tasks:
- [ ] COMMIT
- [ ] DESCRIBE
- [ ] DISCARD
- [ ] GRANT
- [ ] REVOKE
- [ ] SAVEPOINT
- [ ] SHOW
- [ ] USE
## PostgreSQL/BigQuery/MySQL/SparkSQL/ClickHouse/Hive
all tasks:
- [ ] ASSERT
- [ ] BEGIN
- [ ] CACHE
- [ ] CLOSE
- [ ] COPY
- [ ] DEALLOCATE
- [ ] EXECUTE
- [ ] KILL
- [ ] PREPARE
- [ ] UNCACHE
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
從 src/parser.rs 和 PR #942 中引入的現有 src/parser/alter.rs 開始;比較目前的 parser 配置與提議的模組邊界。先定義一個要拆分的小型 parser 區域,然後確認行為維持不變,再將重構擴展到列出的陳述式。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust, sql
- 領域
- compilers, databases
- Issue 類型
- 重構
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 30/100