apache / apache/datafusion-sqlparser-rs

DorisSQL: add Doris Dialect

オープン
#2,379 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
3.5k
フォーク
772
平均マージ
4日 9時間
マージ済み PR(30日)
17

説明

# 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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

計画されているDoris方言のPR 1のスケルトンとAUTO_INCREMENT ASTのクリーンアップから始め、その後、CREATE TABLE句とDorisのロード文まで、段階的な実装計画に従って進めます。完了条件は、Doris固有のAST、CreateTableフィールド、Displayとspanのサポート、パーサーの肯定テストと拒否テスト、ASTアサーション、ラウンドトリップレンダリング、およびコメントのエスケープケースがカバーされていることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust, sql
領域
databases
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。