apache / apache/datafusion-sqlparser-rs
Suggest splitting `parser.rs` into smaller mod files
- 主要言語
- Rust
- スター
- 3.5k
- フォーク
- 772
- 平均マージ
- 4日 9時間
- マージ済み PR(30日)
- 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
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 30/100