apache / apache/datafusion-sqlparser-rs

Suggest splitting `parser.rs` into smaller mod files

未关闭
#944 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
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

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。