File tree Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -535,8 +535,7 @@ impl<'a> Tokenizer<'a> {
535
535
pub fn tokenize ( & mut self ) -> Result < Vec < Token > , TokenizerError > {
536
536
let twl = self . tokenize_with_location ( ) ?;
537
537
538
- let mut tokens: Vec < Token > = vec ! [ ] ;
539
- tokens. reserve ( twl. len ( ) ) ;
538
+ let mut tokens: Vec < Token > = Vec :: with_capacity ( twl. len ( ) ) ;
540
539
for token_with_location in twl {
541
540
tokens. push ( token_with_location. token ) ;
542
541
}
Original file line number Diff line number Diff line change @@ -3440,6 +3440,49 @@ fn parse_create_eventhub_group_peer() {
3440
3440
}
3441
3441
}
3442
3442
3443
+ #[ test]
3444
+ fn parse_create_s3_peer ( ) {
3445
+ match pg ( ) . verified_stmt (
3446
+ "CREATE PEER s3_1 FROM S3 WITH \
3447
+ (url = 's3://bucket_name/prefix_name', \
3448
+ access_key_id = 'access_key_id', \
3449
+ secret_access_key = 'secret_access_key')",
3450
+ ) {
3451
+ Statement :: CreatePeer {
3452
+ if_not_exists : _,
3453
+ peer_name : _,
3454
+ peer_type,
3455
+ with_options,
3456
+ } => {
3457
+ assert_eq ! ( peer_type, PeerType :: S3 ) ;
3458
+ assert_eq ! (
3459
+ with_options,
3460
+ vec![
3461
+ SqlOption {
3462
+ name: Ident :: new( "url" ) ,
3463
+ value: sqlparser:: ast:: Value :: SingleQuotedString ( String :: from(
3464
+ "s3://bucket_name/prefix_name"
3465
+ ) )
3466
+ } ,
3467
+ SqlOption {
3468
+ name: Ident :: new( "access_key_id" ) ,
3469
+ value: sqlparser:: ast:: Value :: SingleQuotedString ( String :: from(
3470
+ "access_key_id"
3471
+ ) )
3472
+ } ,
3473
+ SqlOption {
3474
+ name: Ident :: new( "secret_access_key" ) ,
3475
+ value: sqlparser:: ast:: Value :: SingleQuotedString ( String :: from(
3476
+ "secret_access_key"
3477
+ ) )
3478
+ }
3479
+ ]
3480
+ ) ;
3481
+ }
3482
+ _ => unreachable ! ( ) ,
3483
+ }
3484
+ }
3485
+
3443
3486
#[ test]
3444
3487
fn parse_create_single_mirror ( ) {
3445
3488
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