apache / apache/datafusion-sqlparser-rs
Add pretty printing to more sql constructs
- Vorherrschende Sprache
- Rust
- Sterne
- 3.5k
- Forks
- 772
- Ø Merge
- 4 T. 9 Std.
- Gemergte PRs (30 T.)
- 17
Beschreibung
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
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Das Issue nennt keine Dateien, Tests oder Einstiegspunkte. Überprüfe die nicht abgehakten Checklistenpunkte und kläre ihren Umfang sowie die erwartete Formatierung, bevor du beginnst; erledigt bedeutet, dass die ausgewählten SQL-Konstrukte mittels Pretty-Printing mit der erforderlichen Einrückung und Zeichenkettenbehandlung formatiert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust, sql
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100