github-actions[bot] commented on code in PR #68428:
URL: https://github.com/apache/doris/pull/68428#discussion_r4079440358
##########
be/src/exprs/function/function_regexp.cpp:
##########
@@ -145,13 +145,12 @@ struct RegexpExtractEngine {
return; // No capturing groups
}
+ const re2::StringPiece input(data, size);
Review Comment:
[P1] Fix repeated-search state in the Boost fallback too
This stable-subject/absolute-position fix only updates the RE2 branch. With
`enable_extended_regex=true`, the Boost loop below still has two
repeated-search failures: `(^a(?=a))` on `aaa` rebases `^` on the shortened
range and captures twice, while `(?=(a))` on `ba` finds the zero-width match at
byte 1, advances from the old `search_start`, and emits that same capture twice
(an end lookahead also rescans the suffix quadratically). Both extract-all
return forms share this engine. Please preserve Boost's original boundary
context and advance zero-width searches from the actual match position, with
extended-regex regression cases for both handlers.
##########
be/src/exprs/function/function_regexp.cpp:
##########
@@ -145,13 +145,12 @@ struct RegexpExtractEngine {
return; // No capturing groups
}
+ const re2::StringPiece input(data, size);
size_t pos = 0;
while (pos < size) {
- const char* str_pos = data + pos;
- size_t str_size = size - pos;
std::vector<re2::StringPiece> matches(max_matches);
- bool success = re2_regex->Match(re2::StringPiece(str_pos,
str_size), 0, str_size,
- re2::RE2::UNANCHORED,
matches.data(), max_matches);
+ bool success = re2_regex->Match(input, pos, size,
re2::RE2::UNANCHORED,
Review Comment:
[P1] Advance from the actual empty-match position
After switching `Match` to the full input, an empty match can be found later
than `pos`, but the branch below still does only `pos += 1`. For an all-word
string and `(\\b)` (or `\\b` in `regexp_count`), every search after the initial
boundary scans to the same empty boundary at the end, then advances one byte
from the old start; this changes the loop to quadratic rescanning in both
extract-all handlers and `regexp_count`. Please derive progress from the
returned match offset (and stop/advance safely when it is at the subject end),
with a focused word-boundary regression.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]