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

Function regexp_count_func

datafusion/functions/src/regex/regexpcount.rs:139–164  ·  view source on GitHub ↗
(args: &[ArrayRef])

Source from the content-addressed store, hash-verified

137}
138
139pub fn regexp_count_func(args: &[ArrayRef]) -> Result<ArrayRef> {
140 let args_len = args.len();
141 if !(2..=4).contains(&args_len) {
142 return exec_err!(
143 "regexp_count was called with {args_len} arguments. It requires at least 2 and at most 4."
144 );
145 }
146
147 let values = &args[0];
148 match values.data_type() {
149 Utf8 | LargeUtf8 | Utf8View => (),
150 other => {
151 return internal_err!(
152 "Unsupported data type {other:?} for function regexp_count"
153 );
154 }
155 }
156
157 regexp_count(
158 values,
159 &args[1],
160 if args_len > 2 { Some(&args[2]) } else { None },
161 if args_len > 3 { Some(&args[3]) } else { None },
162 )
163 .map_err(|e| e.into())
164}
165
166/// `arrow-rs` style implementation of `regexp_count` function.
167/// This function `regexp_count` is responsible for counting the occurrences of a regular expression pattern

Calls 5

regexp_countFunction · 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…