apache / apache/datafusion-sqlparser-rs

Add pretty printing to more sql constructs

未关闭
#1,850 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
3.5k
派生
772
平均合并
4 天 9 小时
30 天内合并 PR
17

描述

This is a followup on https://github.com/apache/datafusion-sqlparser-rs/pull/1847

Here are some constructs that are currently not handled by the pretty printer (they are displayed on a single line). I'm opening this to serve as a tracking issue to track implementation of these.

* [x] Format `INSERT INTO` with both `VALUES` and `SELECT` forms
* [x] Support `UPDATE` and `DELETE` with proper clause indentation
* [x] indent `CREATE TABLE` column definitions and constraints
* [x] Format `CREATE VIEW` and nested `SELECT` cleanly
* [ ] Handle `CREATE FUNCTION`/`PROCEDURE` blocks with inner SQL formatting
* [ ] format `json_table` and `xmltable`
* [ ] Format `BEGIN`, `COMMIT`, `ROLLBACK` blocks clearly
* [ ] Support control flow structures (`IF`, `WHILE`, `LOOP`) with block indentation
* [ ] support multiline strings (the indentation should not be reflected inside the string)
* [ ] Handle `MERGE` statements with `WHEN MATCHED` and `WHEN NOT MATCHED` branches
* [ ] format `CREATE INDEX` with minimal structure
* [ ] Handle `EXPLAIN`, `EXPLAIN ANALYZE`, and `DESCRIBE` statements

cc @alamb

贡献指南

这个仓库没有索引到贡献指南

调研方向

该 issue 未指定任何文件、测试或入口点。开始之前,请检查未勾选的清单项,并明确其范围和预期格式;完成意味着选定的 SQL 构造已按照要求的缩进和字符串处理方式进行美化打印。

由索引模型根据 Issue 内容生成。

评估

技术栈
rust, sql
领域
compilers
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

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