datafusion_functions::regex::regexpcount

Function regexp_count

Source
pub fn regexp_count(
    values: &dyn Array,
    regex_array: &dyn Datum,
    start_array: Option<&dyn Datum>,
    flags_array: Option<&dyn Datum>,
) -> Result<ArrayRef, ArrowError>
Expand description

arrow-rs style implementation of regexp_count function. This function regexp_count is responsible for counting the occurrences of a regular expression pattern within a string array. It supports optional start positions and flags for case insensitivity.

The function accepts a variable number of arguments:

  • values: The array of strings to search within.
  • regex_array: The array of regular expression patterns to search for.
  • start_array (optional): The array of start positions for the search.
  • flags_array (optional): The array of flags to modify the search behavior (e.g., case insensitivity).

The function handles different combinations of scalar and array inputs for the regex patterns, start positions, and flags. It uses a cache to store compiled regular expressions for efficiency.

ยงErrors

Returns an error if the input arrays have mismatched lengths or if the regular expression fails to compile.