apache / apache/datafusion-sqlparser-rs
Support Clickhouse ASSUME table constraints (and remove required parenthetical)
- 主要言語
- Rust
- スター
- 3.5k
- フォーク
- 772
- 平均マージ
- 4日 9時間
- マージ済み PR(30日)
- 17
説明
Hello, currently [Clickhouse's ASSUME table constraints](https://clickhouse.com/docs/reference/statements/create/table#constraints) generate parse errors:
```bash
$ cat assume_test.sql
CREATE TABLE my_table (
`date` Date,
CONSTRAINT my_constraint ASSUME (date > '2025-01-01')
)
ENGINE = MergeTree
;
```
----
```bash
$ cargo run --features json_example --example cli assume_test.sql --clickhouse
Finished [`dev` profile [unoptimized + debuginfo]](https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles) target(s) in 0.01s
Running `target/debug/examples/cli assume_test.sql --clickhouse`
Parsing from file 'assume_test.sql' using ClickHouseDialect
2026-08-31T00:27:53.248Z DEBUG [sqlparser::parser] Parsing sql 'CREATE TABLE my_table (
`date` Date,
CONSTRAINT my_constraint ASSUME (date > '2025-01-01')
)
ENGINE = MergeTree
;
'...
Error during parsing: ParserError("Expected: PRIMARY, UNIQUE, FOREIGN, CHECK, or EXCLUDE, found: ASSUME at Line: 3, Column: 30")
```
In addition, in Clickhouse table constraint expressions aren't required to have top-level parenthesis. We should support these dialect attributes for Clickhouse.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
`cargo run --features json_example --example cli assume_test.sql --clickhouse` コマンドによって実行される ClickHouseDialect パーサーパスから始めます。issue の SQL 例を解析ケースとして使用し、ASSUME テーブル制約がトップレベルの括弧あり・括弧なしの両方で正常に解析できれば、作業完了とみなします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust, sql
- 領域
- databases
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 72/100