MCPcopy Create free account
hub / github.com/apache/datafusion / regexp_instr_func

Function regexp_instr_func

datafusion/functions/src/regex/regexpinstr.rs:156–183  ·  view source on GitHub ↗
(args: &[ArrayRef])

Source from the content-addressed store, hash-verified

154}
155
156pub fn regexp_instr_func(args: &[ArrayRef]) -> Result<ArrayRef> {
157 let args_len = args.len();
158 if !(2..=6).contains(&args_len) {
159 return exec_err!(
160 "regexp_instr was called with {args_len} arguments. It requires at least 2 and at most 6."
161 );
162 }
163
164 let values = &args[0];
165 match values.data_type() {
166 Utf8 | LargeUtf8 | Utf8View => (),
167 other => {
168 return internal_err!(
169 "Unsupported data type {other:?} for function regexp_instr"
170 );
171 }
172 }
173
174 regexp_instr(
175 values,
176 &args[1],
177 if args_len > 2 { Some(&args[2]) } else { None },
178 if args_len > 3 { Some(&args[3]) } else { None },
179 if args_len > 4 { Some(&args[4]) } else { None },
180 if args_len > 5 { Some(&args[5]) } else { None },
181 )
182 .map_err(|e| e.into())
183}
184
185/// `arrow-rs` style implementation of `regexp_instr` function.
186/// This function `regexp_instr` is responsible for returning the index of a regular expression pattern

Calls 5

regexp_instrFunction · 0.70
lenMethod · 0.45
containsMethod · 0.45
data_typeMethod · 0.45
intoMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…