File tree Expand file tree Collapse file tree 4 files changed +33
-0
lines changed
Expand file tree Collapse file tree 4 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -2876,6 +2876,7 @@ pub enum PeerType {
28762876 Eventhubs ,
28772877 PubSub ,
28782878 Elasticsearch ,
2879+ Clickhouse ,
28792880}
28802881
28812882impl fmt:: Display for PeerType {
@@ -2892,6 +2893,7 @@ impl fmt::Display for PeerType {
28922893 PeerType :: Eventhubs => write ! ( f, "EVENTHUBS" ) ,
28932894 PeerType :: PubSub => write ! ( f, "PUBSUB" ) ,
28942895 PeerType :: Elasticsearch => write ! ( f, "ELASTICSEARCH" ) ,
2896+ PeerType :: Clickhouse => write ! ( f, "CLICKHOUSE" ) ,
28952897 }
28962898 }
28972899}
Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ define_keywords!(
147147 CHARSET ,
148148 CHAR_LENGTH ,
149149 CHECK ,
150+ CLICKHOUSE ,
150151 CLOB ,
151152 CLONE ,
152153 CLOSE ,
Original file line number Diff line number Diff line change @@ -9828,6 +9828,7 @@ impl<'a> Parser<'a> {
98289828 Keyword :: EVENTHUBS ,
98299829 Keyword :: PUBSUB ,
98309830 Keyword :: ELASTICSEARCH ,
9831+ Keyword :: CLICKHOUSE ,
98319832 ] ) {
98329833 Some ( Keyword :: BIGQUERY ) => Ok ( PeerType :: Bigquery ) ,
98339834 Some ( Keyword :: MONGO ) => Ok ( PeerType :: Mongo ) ,
@@ -9840,6 +9841,7 @@ impl<'a> Parser<'a> {
98409841 Some ( Keyword :: EVENTHUBS ) => Ok ( PeerType :: Eventhubs ) ,
98419842 Some ( Keyword :: PUBSUB ) => Ok ( PeerType :: PubSub ) ,
98429843 Some ( Keyword :: ELASTICSEARCH ) => Ok ( PeerType :: Elasticsearch ) ,
9844+ Some ( Keyword :: CLICKHOUSE ) => Ok ( PeerType :: Clickhouse ) ,
98439845 other => {
98449846 let supported_peer_types = [
98459847 "BIGQUERY" ,
@@ -9853,6 +9855,7 @@ impl<'a> Parser<'a> {
98539855 "EVENTHUBS" ,
98549856 "PUBSUB" ,
98559857 "ELASTICSEARCH" ,
9858+ "CLICKHOUSE" ,
98569859 ] ;
98579860 let err = format ! (
98589861 "expected peertype as one of {}, got {:#?}" ,
Original file line number Diff line number Diff line change @@ -3678,6 +3678,33 @@ fn parse_create_s3_peer() {
36783678 }
36793679}
36803680
3681+ #[ test]
3682+ fn parse_create_clickhouse_peer ( ) {
3683+ match pg ( ) . verified_stmt (
3684+ "CREATE PEER clickhouse_1 FROM CLICKHOUSE WITH \
3685+ (host = 'http://clickhouse-server:8123')",
3686+ ) {
3687+ Statement :: CreatePeer {
3688+ if_not_exists : _,
3689+ peer_name : _,
3690+ peer_type,
3691+ with_options,
3692+ } => {
3693+ assert_eq ! ( peer_type, PeerType :: Clickhouse ) ;
3694+ assert_eq ! (
3695+ with_options,
3696+ vec![ SqlOption {
3697+ name: Ident :: new( "host" ) ,
3698+ value: Expr :: Value ( Value :: SingleQuotedString ( String :: from(
3699+ "http://clickhouse-server:8123"
3700+ ) ) )
3701+ } , ]
3702+ ) ;
3703+ }
3704+ _ => unreachable ! ( ) ,
3705+ }
3706+ }
3707+
36813708#[ test]
36823709fn parse_create_single_mirror ( ) {
36833710 match pg ( ) . verified_stmt ( "CREATE MIRROR IF NOT EXISTS test_mirror FROM p1 TO p2 WITH TABLE MAPPING ({from : s1.t1, to : s2.t2}) WITH (key1 = 'value1')" ) {
You can’t perform that action at this time.
0 commit comments