File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ impl Dialect {
38
38
Dialect :: MsSql => Box :: new ( MsSqlDialect ) ,
39
39
Dialect :: MySql => Box :: new ( MySqlDialect ) ,
40
40
Dialect :: BigQuery => Box :: new ( BigQueryDialect ) ,
41
+ Dialect :: ClickHouse => Box :: new ( ClickHouseDialect ) ,
41
42
_ => Box :: new ( GenericDialect ) ,
42
43
}
43
44
}
@@ -53,6 +54,7 @@ pub struct GenericDialect;
53
54
pub struct MySqlDialect ;
54
55
pub struct MsSqlDialect ;
55
56
pub struct BigQueryDialect ;
57
+ pub struct ClickHouseDialect ;
56
58
57
59
pub trait DialectHandler {
58
60
fn dialect ( & self ) -> Dialect ;
@@ -89,6 +91,15 @@ impl DialectHandler for MySqlDialect {
89
91
}
90
92
}
91
93
94
+ impl DialectHandler for ClickHouseDialect {
95
+ fn dialect ( & self ) -> Dialect {
96
+ Dialect :: ClickHouse
97
+ }
98
+ fn ident_quote ( & self ) -> char {
99
+ '`'
100
+ }
101
+ }
102
+
92
103
impl DialectHandler for BigQueryDialect {
93
104
fn dialect ( & self ) -> Dialect {
94
105
Dialect :: BigQuery
Original file line number Diff line number Diff line change @@ -1475,6 +1475,24 @@ take 20
1475
1475
"### ) ;
1476
1476
}
1477
1477
1478
+ #[ test]
1479
+ fn test_dialect_clickhouse ( ) {
1480
+ let query = r###"
1481
+ prql dialect:clickhouse
1482
+
1483
+ from github_json
1484
+ derive [event_type_dotted = `event.type`]
1485
+ "### ;
1486
+
1487
+ assert_display_snapshot ! ( ( compile( query) . unwrap( ) ) , @r###"
1488
+ SELECT
1489
+ github_json.*,
1490
+ github_json.`event.type` AS event_type_dotted
1491
+ FROM
1492
+ github_json
1493
+ "### ) ;
1494
+ }
1495
+
1478
1496
#[ test]
1479
1497
#[ ignore]
1480
1498
fn test_ident_escaping ( ) {
You can’t perform that action at this time.
0 commit comments