File tree Expand file tree Collapse file tree
datafusion/functions/src/regex Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -461,6 +461,7 @@ mod tests {
461461 test_case_sensitive_regexp_instr_scalar_start ( ) ;
462462 test_case_sensitive_regexp_instr_scalar_nth ( ) ;
463463 test_case_sensitive_regexp_instr_scalar_subexp ( ) ;
464+ test_regexp_instr_empty_pattern_global_flag ( ) ;
464465
465466 test_case_sensitive_regexp_instr_array :: < GenericStringArray < i32 > > ( ) ;
466467 test_case_sensitive_regexp_instr_array :: < GenericStringArray < i64 > > ( ) ;
@@ -772,6 +773,22 @@ mod tests {
772773 } ) ;
773774 }
774775
776+ fn test_regexp_instr_empty_pattern_global_flag ( ) {
777+ let args = [
778+ ScalarValue :: Utf8 ( Some ( "abc" . to_string ( ) ) ) ,
779+ ScalarValue :: Utf8 ( Some ( "" . to_string ( ) ) ) ,
780+ ScalarValue :: Int64 ( Some ( 1 ) ) ,
781+ ScalarValue :: Int64 ( Some ( 1 ) ) ,
782+ ScalarValue :: Utf8 ( Some ( "g" . to_string ( ) ) ) ,
783+ ] ;
784+ let err = regexp_instr_with_scalar_values ( & args)
785+ . expect_err ( "global flag should be rejected for empty patterns" ) ;
786+ assert ! (
787+ err. to_string( ) . contains( "does not support the global flag" ) ,
788+ "{err}"
789+ ) ;
790+ }
791+
775792 fn test_case_sensitive_regexp_instr_array < A > ( )
776793 where
777794 A : From < Vec < & ' static str > > + Array + ' static ,
You can’t perform that action at this time.
0 commit comments