@@ -440,24 +440,36 @@ impl ScalarUDFImpl for RefreshMaterializedView {
440
440
}
441
441
442
442
fn parse_transform ( input : & str ) -> Result < ( String , Transform ) , Error > {
443
- let re = Regex :: new ( r"(\w+)\((.*)\)" ) . unwrap ( ) ;
444
- let caps = re
445
- . captures ( input)
446
- . ok_or ( Error :: InvalidFormat ( "Partition transform" . to_owned ( ) ) ) ?;
447
- let transform_name = caps
448
- . get ( 1 )
449
- . ok_or ( Error :: InvalidFormat ( "Partition transform" . to_owned ( ) ) ) ?
450
- . as_str ( )
451
- . to_string ( ) ;
452
- let args = caps
453
- . get ( 2 )
454
- . ok_or ( Error :: InvalidFormat ( "Partition column" . to_owned ( ) ) ) ?
455
- . as_str ( ) ;
456
- let mut args = args. split ( "," ) . map ( |s| s. to_string ( ) ) ;
457
- let column = args
458
- . next ( )
459
- . ok_or ( Error :: InvalidFormat ( "Partition column" . to_owned ( ) ) ) ?;
460
- let arg = args. next ( ) ;
443
+ let short = Regex :: new ( r"(\w+)" ) . unwrap ( ) ;
444
+ let full = Regex :: new ( r"(\w+)\((.*)\)" ) . unwrap ( ) ;
445
+
446
+ let ( transform_name, column, arg) = if let Some ( caps) = short. captures ( input) {
447
+ let column = caps
448
+ . get ( 1 )
449
+ . ok_or ( Error :: InvalidFormat ( "Partition column" . to_owned ( ) ) ) ?
450
+ . as_str ( )
451
+ . to_string ( ) ;
452
+ ( "identity" . to_owned ( ) , column, None )
453
+ } else {
454
+ let caps = full
455
+ . captures ( input)
456
+ . ok_or ( Error :: InvalidFormat ( "Partition transform" . to_owned ( ) ) ) ?;
457
+ let transform_name = caps
458
+ . get ( 1 )
459
+ . ok_or ( Error :: InvalidFormat ( "Partition transform" . to_owned ( ) ) ) ?
460
+ . as_str ( )
461
+ . to_string ( ) ;
462
+ let args = caps
463
+ . get ( 2 )
464
+ . ok_or ( Error :: InvalidFormat ( "Partition column" . to_owned ( ) ) ) ?
465
+ . as_str ( ) ;
466
+ let mut args = args. split ( "," ) . map ( |s| s. to_string ( ) ) ;
467
+ let column = args
468
+ . next ( )
469
+ . ok_or ( Error :: InvalidFormat ( "Partition column" . to_owned ( ) ) ) ?;
470
+ let arg = args. next ( ) ;
471
+ ( transform_name, column, arg)
472
+ } ;
461
473
match ( transform_name. as_str ( ) , column, arg) {
462
474
( "identity" , column, None ) => Ok ( ( column, Transform :: Identity ) ) ,
463
475
( "void" , column, None ) => Ok ( ( column, Transform :: Void ) ) ,
0 commit comments