apache / apache/datafusion-sqlparser-rs
Suggest splitting `parser.rs` into smaller mod files
- Lingua principale
- Rust
- Stelle
- 3.5k
- Fork
- 772
- Merge medio
- 4g 9h
- PR unite (30g)
- 17
Descrizione
# 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
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia con src/parser.rs e l’attuale src/parser/alter.rs, introdotto in PR #942; confronta l’organizzazione corrente del parser con i confini dei moduli proposti. Definisci prima una piccola area del parser da suddividere, quindi verifica che il comportamento rimanga invariato prima di estendere il refactoring alle istruzioni elencate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust, sql
- Ambito
- compilers, databases
- Tipo di issue
- Refactoring
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 30/100