-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Feature] Implement Regexp_Position in C++ mode #67252
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
base: main
Are you sure you want to change the base?
Conversation
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
|
@cursor review |
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.
✅ Bugbot reviewed your changes and found no bugs!
|
@mergify rebase |
✅ Branch has been successfully rebased |
b8d7f28 to
75eb4c1
Compare
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
| context->set_function_state(scope, state); | ||
|
|
||
| // check if pattern is constant | ||
| if (context->is_constant_column(1)) { |
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.
| if (context->is_constant_column(1)) { | |
| if (!context->is_constant_column(1)) { | |
| return Status::OK(); | |
| } |
|
|
||
| -- name: test_regexp_position | ||
|
|
||
| SELECT regexp_position('a.b:c;d', '[.]'); |
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.
All the cases are testing the optimized logic. Please add some cases to test the general path.
And please add some cases to test invalid inputs, like null
Why I'm doing:
REGEXP_Position is supported by Trino but not supported by StarRocks
When this function call is passed to StarRocks in my company's scenario, this will result in error
What I'm doing:
Returns the position of the specified occurrence of the regular expression pattern in the string subject
Fixes #67246
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check:
Note
Introduces
regexp_positionto return the 1-based position of the Nth regex match in a string, with UTF-8 correctness and error handling.StringFunctions::regexp_positionwith prepare/close, constant-pattern optimization, UTF-8 code-point indexing, support forstart_posandoccurrence, returns-1when not found, and surfaces invalid regex errors.REGEXP_POSITIONtoFunctionSet; analyzer fills default args (start_pos=1, occurrence=1) and resolves builtin viagetRegexpPositionFunction.gensrc/script/functions.pywith INT return and prepare/close hooks.Written by Cursor Bugbot for commit 75eb4c1. This will update automatically on new commits. Configure here.