ClickHouse CREATE TABLE Fixes: add ORDER BY and fix clause ordering (#824)

* Fix ClickHouse (add ORDER BY)

* Improve test case
This commit is contained in:
Ankur Goyal 2023-03-06 06:55:55 -08:00 committed by GitHub
parent 1cf913e717
commit d69b875367
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 11 deletions

View file

@ -317,6 +317,18 @@ fn parse_similar_to() {
chk(true);
}
#[test]
fn parse_create_table() {
clickhouse().verified_stmt(r#"CREATE TABLE "x" ("a" "int") ENGINE=MergeTree ORDER BY ("x")"#);
clickhouse().one_statement_parses_to(
r#"CREATE TABLE "x" ("a" "int") ENGINE=MergeTree ORDER BY "x""#,
r#"CREATE TABLE "x" ("a" "int") ENGINE=MergeTree ORDER BY ("x")"#,
);
clickhouse().verified_stmt(
r#"CREATE TABLE "x" ("a" "int") ENGINE=MergeTree ORDER BY ("x") AS SELECT * FROM "t" WHERE true"#,
);
}
fn clickhouse() -> TestedDialects {
TestedDialects {
dialects: vec![Box::new(ClickHouseDialect {})],