apache / apache/datafusion-sqlparser-rs
Suggest splitting `parser.rs` into smaller mod files
- Langage dominant
- Rust
- Étoiles
- 3.5k
- Forks
- 772
- Merge moyen
- 4 j 9 h
- PR mergées (30 j)
- 17
Description
# 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
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par src/parser.rs et le src/parser/alter.rs existant, introduit dans PR #942 ; comparez l’organisation actuelle du parser avec les limites de modules proposées. Définissez d’abord une petite partie du parser à scinder, puis vérifiez que le comportement reste inchangé avant d’étendre le refactoring aux instructions listées.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- rust, sql
- Domaine
- compilers, databases
- Type d'issue
- Refactorisation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 30/100