druid SQL Parser能否支持下clickhouse的DDL语法?

ggazkfy8  于 23天前  发布在  Druid
关注(0)|答案(7)|浏览(16)

如题

clj7thdc

clj7thdc1#

支持的,遇到什么不支持的语法了?

owfi6suc

owfi6suc2#

支持的,遇到什么不支持的语法了?

比如如下的建表语句在clickhouse上执行会由于没有指定主键会报错:

CREATE TABLE db1.tab2
(
    `id` Int32
)
ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/db1.tab2', '{replica}');

报错信息如下:

Received exception from server (version 20.8.7):
Code: 42. DB::Exception: Received from localhost:9000. DB::Exception: Storage ReplicatedMergeTree requires 5 to 6 parameters: 
path in ZooKeeper,
replica name,
name of column with date,
[sampling element of primary key],
primary key expression,
index granularity

Syntax for the MergeTree table engine:

CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster]
(
    name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1],
    name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2],
    ...
    INDEX index_name1 expr1 TYPE type1(...) GRANULARITY value1,
    INDEX index_name2 expr2 TYPE type2(...) GRANULARITY value2
) ENGINE = MergeTree()
ORDER BY expr
[PARTITION BY expr]
[PRIMARY KEY expr]
[SAMPLE BY expr]
[TTL expr [DELETE|TO DISK 'xxx'|TO VOLUME 'xxx'], ...]
[SETTINGS name=value, ...]

See details in documentation: https://clickhouse.tech/docs/en/engines/table-engines/mergetree-family/mergetree/. Other engines of the family support different syntax, see details in the corresponding documentation topics.

If you use the Replicated version of engines, see https://clickhouse.tech/docs/en/engines/table-engines/mergetree-family/replication/.
.

使用1.2.6版本能正常解析出statement却没有报错产生。

brccelvz

brccelvz3#

补充下:其中on cluster xxx 不支持, primary key xxx 不支持,partition by 不支持,TTL语法不支持。

noj0wjuj

noj0wjuj7#

支持的,遇到什么不支持的语法了?

on cluster xxx 不支持, primary key xxx 不支持,partition by 不支持,TTL语法不支持,这几种语法有计划支持吗

相关问题