-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add regexp_substr function #14323
base: main
Are you sure you want to change the base?
Conversation
Is this materially different than #14282 ? |
let cleaned_value = if let Some(start) = start { | ||
if start < 1 { | ||
return Err(DataFusionError::from(ArrowError::ComputeError( | ||
"regexp_count() requires start to be 1 based".to_string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"regexp_count() requires start to be 1 based".to_string(), | |
"regexp_substr() requires start to be 1 based".to_string(), |
|
||
static DOCUMENTATION: OnceLock<Documentation> = OnceLock::new(); | ||
|
||
fn get_regexp_substr_doc() -> &'static Documentation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to use the new doc macro as it's been incorporated into most every udf at this point.
// Planner attempts coercion to the target type starting with the most preferred candidate. | ||
// For example, given input `(Utf8View, Utf8)`, it first tries coercing to `(Utf8, Utf8)`. | ||
// If that fails, it proceeds to `(LargeUtf8, Utf8)`. | ||
TypeSignature::Exact(vec![Utf8, Utf8]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We likely want to include Utf8View into this signature.
Thank you for your contribution! I have 2 concerns:
|
Which issue does this PR close?
Closes #11946
Rationale for this change
Implementation for
regexp_substr()
regexp_substr()
What changes are included in this PR?
Add regex udf that returns the substring that matches a regular expression within a string.
Are there any user-facing changes?
No user-facing changes since this is a new functionality