@@ -81,26 +81,7 @@ impl RegexpLikeFunc {
81
81
pub fn new ( ) -> Self {
82
82
Self {
83
83
signature : Signature :: one_of (
84
- vec ! [
85
- TypeSignature :: Exact ( vec![ Utf8View , Utf8 ] ) ,
86
- TypeSignature :: Exact ( vec![ Utf8View , Utf8View ] ) ,
87
- TypeSignature :: Exact ( vec![ Utf8View , LargeUtf8 ] ) ,
88
- TypeSignature :: Exact ( vec![ Utf8 , Utf8 ] ) ,
89
- TypeSignature :: Exact ( vec![ Utf8 , Utf8View ] ) ,
90
- TypeSignature :: Exact ( vec![ Utf8 , LargeUtf8 ] ) ,
91
- TypeSignature :: Exact ( vec![ LargeUtf8 , Utf8 ] ) ,
92
- TypeSignature :: Exact ( vec![ LargeUtf8 , Utf8View ] ) ,
93
- TypeSignature :: Exact ( vec![ LargeUtf8 , LargeUtf8 ] ) ,
94
- TypeSignature :: Exact ( vec![ Utf8View , Utf8 , Utf8 ] ) ,
95
- TypeSignature :: Exact ( vec![ Utf8View , Utf8View , Utf8 ] ) ,
96
- TypeSignature :: Exact ( vec![ Utf8View , LargeUtf8 , Utf8 ] ) ,
97
- TypeSignature :: Exact ( vec![ Utf8 , Utf8 , Utf8 ] ) ,
98
- TypeSignature :: Exact ( vec![ Utf8 , Utf8View , Utf8 ] ) ,
99
- TypeSignature :: Exact ( vec![ Utf8 , LargeUtf8 , Utf8 ] ) ,
100
- TypeSignature :: Exact ( vec![ LargeUtf8 , Utf8 , Utf8 ] ) ,
101
- TypeSignature :: Exact ( vec![ LargeUtf8 , Utf8View , Utf8 ] ) ,
102
- TypeSignature :: Exact ( vec![ LargeUtf8 , LargeUtf8 , Utf8 ] ) ,
103
- ] ,
84
+ vec ! [ TypeSignature :: String ( 2 ) , TypeSignature :: String ( 3 ) ] ,
104
85
Volatility :: Immutable ,
105
86
) ,
106
87
}
@@ -211,7 +192,34 @@ pub fn regexp_like(args: &[ArrayRef]) -> Result<ArrayRef> {
211
192
match args. len ( ) {
212
193
2 => handle_regexp_like ( & args[ 0 ] , & args[ 1 ] , None ) ,
213
194
3 => {
214
- let flags = args[ 2 ] . as_string :: < i32 > ( ) ;
195
+ let flags = match args[ 2 ] . data_type ( ) {
196
+ Utf8 => args[ 2 ] . as_string :: < i32 > ( ) ,
197
+ LargeUtf8 => {
198
+ let large_string_array = args[ 2 ] . as_string :: < i64 > ( ) ;
199
+ let string_vec: Vec < Option < & str > > = ( 0 ..large_string_array. len ( ) ) . map ( |i| {
200
+ if large_string_array. is_null ( i) {
201
+ None
202
+ } else {
203
+ Some ( large_string_array. value ( i) )
204
+ }
205
+ } )
206
+ . collect ( ) ;
207
+
208
+ & GenericStringArray :: < i32 > :: from ( string_vec)
209
+ } ,
210
+ _ => {
211
+ let string_view_array = args[ 2 ] . as_string_view ( ) ;
212
+ let string_vec: Vec < Option < String > > = ( 0 ..string_view_array. len ( ) ) . map ( |i| {
213
+ if string_view_array. is_null ( i) {
214
+ None
215
+ } else {
216
+ Some ( string_view_array. value ( i) . to_string ( ) )
217
+ }
218
+ } )
219
+ . collect ( ) ;
220
+ & GenericStringArray :: < i32 > :: from ( string_vec)
221
+ } ,
222
+ } ;
215
223
216
224
if flags. iter ( ) . any ( |s| s == Some ( "g" ) ) {
217
225
return plan_err ! ( "regexp_like() does not support the \" global\" option" ) ;
0 commit comments