(args: &[ArrayRef])
| 137 | } |
| 138 | |
| 139 | pub 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 |
searching dependent graphs…