Skip to content

Commit

Permalink
fix check
Browse files Browse the repository at this point in the history
  • Loading branch information
xinlifoobar committed Aug 20, 2024
1 parent ee23b97 commit d5b63f4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions datafusion/functions/src/regex/regexpcount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,6 @@ fn regex_iter_count<'a>(
return Ok(0);
}

if regex.contains('g') {
return Err(ArrowError::ComputeError(
"regexp_count() does not support global flag".to_string(),
));
}

if start <= 0 {
return Err(ArrowError::ComputeError(
"regexp_count() requires start to be 1 based".to_string(),
Expand All @@ -326,6 +320,12 @@ fn regex_iter_count<'a>(
let pattern = if let Some(Some(flags)) =
flags.map(|x| if x.is_empty() { None } else { Some(x) })
{
if flags.contains('g') {
return Err(ArrowError::ComputeError(
"regexp_count() does not support global flag".to_string(),
));
}

format!("(?{flags}){regex}")
} else {
regex.to_string()
Expand Down

0 comments on commit d5b63f4

Please sign in to comment.