github-actions[bot] commented on code in PR #68359:
URL: https://github.com/apache/doris/pull/68359#discussion_r4078850666
##########
be/src/exprs/function/function_regexp.cpp:
##########
@@ -579,8 +575,7 @@ struct RegexpExtractImpl {
context->state()->enable_extended_regex());
if (!st) {
context->add_warning(error_str.c_str());
- StringOP::push_null_string(index_now, result_data,
result_offset, null_map);
- return;
+ throw Exception(Status::InvalidArgument(error_str));
Review Comment:
[P2] Validate column patterns before the negative-index shortcut
Both extract variants still skip this compile path when the group index is
negative: `_execute_loop` returns empty/NULL before calling
`_execute_inner_loop`. Consequently `regexp_extract('abc', p, -1)` with `p =
'['` succeeds, while `regexp_extract('abc', '[', -1)` fails in `open()`, so the
constant/column inconsistency remains. Compile/validate a nonconstant pattern
before the negative-index result shortcut and add `-1` cases for
`regexp_extract` and `regexp_extract_or_null`.
##########
be/src/exprs/function/function_regexp.cpp:
##########
@@ -464,8 +461,7 @@ struct RegexpReplaceImpl {
options_value, scoped_re);
if (!st) {
context->add_warning(error_str.c_str());
- StringOP::push_null_string(index_now, result_data,
result_offset, null_map);
- return;
+ throw Exception(Status::InvalidArgument(error_str));
Review Comment:
[P1] Avoid compiling hidden payloads for NULL patterns
The default nullable wrapper strips a mixed nullable pattern to its nested
column and executes every row before restoring the NULL map; those nested bytes
are explicitly arbitrary. For example, `regexp_replace(s, concat(p, if(id = 2,
NULL, '')), repl)` can have a SQL-NULL pattern on the row where `p` is `[`,
while retaining `[` underneath. This new throw then aborts the query instead of
returning NULL as SQL null propagation requires (the old branch marked the row
NULL). Please sanitize NULL payloads before these compile loops (for example
via `need_replace_null_data_to_default()`) or skip NULL pattern rows, and cover
a mixed nullable pattern with an invalid hidden payload. The same issue applies
to the extract and extract-all throw sites.
--
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]