apache / apache/datafusion-sqlparser-rs
DorisSQL: add Doris Dialect
- Lingua principale
- Rust
- Stelle
- 3.5k
- Fork
- 772
- Merge medio
- 4g 9h
- PR unite (30g)
- 17
Descrizione
# Doris SQL: Support Doris Dialect
## Summary
Add Doris SQL dialect, covering the core Doris syntax needed to parse common Doris DDL and load statements.
## Motivation
Apache Doris has SQL syntax that differs from the generic SQL dialect, especially around `CREATE TABLE` clauses, key models, partition/distribution definitions, table properties, and Doris-specific load statements. A dedicated `DorisDialect` would let users parse Doris SQL without weakening generic parser behavior.
## Proposed Scope
- Add `DorisDialect`
- Support Doris `CREATE TABLE` clauses:
- `ENGINE = OLAP`
- `DUPLICATE KEY`, `UNIQUE KEY`, `AGGREGATE KEY`
- table `COMMENT`
- `PARTITION BY RANGE/LIST`
- `AUTO PARTITION`
- `DISTRIBUTED BY HASH/RANDOM`
- `BUCKETS` / `BUCKETS AUTO`
- `PROPERTIES (...)`
- Support Doris column options such as `AUTO_INCREMENT`
- Support Doris `LOAD DATA INFILE`
- Support Doris `CREATE ROUTINE LOAD`
- Preserve generic dialect behavior where Doris-only syntax should remain rejected
## Parser / AST Changes
- Add Doris-specific AST structures for key model, partition, distribution, table properties, and load statements
- Extend `CreateTable` with optional Doris-specific fields
- Add `Display` support for canonical SQL rendering
- Add span support for newly introduced AST nodes where applicable
## Tests
Add Doris parser tests covering:
- Positive Doris parsing cases
- Generic/ANSI rejection cases for Doris-only syntax
- AST structure assertions
- Round-trip canonical rendering
- Escaping behavior for table comments containing single quotes
## Implementation Plan
This feature is delivered as a stacked PR series. Each PR builds on the previous one.
- PR 1: Doris dialect skeleton + AUTO_INCREMENT AST cleanup
- PR 2: CREATE TABLE column options
- PR 3: CREATE TABLE key model and distribution
- PR 4: CREATE TABLE partition clauses + ON UPDATE + double-quoted COMMENT
- PR 5: LOAD DATA INFILE
- PR 6: CREATE ROUTINE LOAD
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia con lo scheletro pianificato del PR 1 per il dialetto Doris e la pulizia dell’AST di AUTO_INCREMENT, poi segui il piano di implementazione impilato fino alle clausole CREATE TABLE e alle istruzioni di caricamento di Doris. Il lavoro è completo quando sono coperti l’AST specifico di Doris, i campi di CreateTable, il supporto a Display e span, i test positivi e di rifiuto del parser, le asserzioni sull’AST, il rendering di andata e ritorno e i casi di escaping dei commenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust, sql
- Ambito
- databases
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100