mrhhsg commented on code in PR #68359:
URL: https://github.com/apache/doris/pull/68359#discussion_r4080653549
##########
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:
Good catch, reproduced locally: with `regexp_replace(s, concat(p, if(id = 2,
NULL, '')), repl)` the SQL-NULL row still carries `[` underneath and the new
throw aborted the query.
`need_replace_null_data_to_default()` does not help here:
`replace_column_null_data` is a no-op for `ColumnString` (only
`ColumnVector`/`ColumnDecimal` implement it), and even with a string
implementation it would copy every nullable argument that has a NULL, including
the haystack column on the constant-pattern path that does not need it. So this
now takes the other route you suggested: the regexp functions set
`use_default_implementation_for_nulls()` to false, a shared
`unnest_regexp_arguments` strips Nullable from the arguments and ORs their null
maps into the result null map, a NULL constant argument short-circuits to an
all-NULL result, and the execute loops skip NULL rows. No bytes under a NULL
slot reach the compiler and nothing is copied. `open()` also skips a NULL
constant pattern. The same fix covers the extract / extract-all / count sites.
Coverage: `FunctionLikeTest.regexp_null_pattern_hides_invalid_payload`
(nullable pattern column whose NULL row hides `[`, plus a NULL constant pattern
with `[` underneath, for every family) and the `*_null_payload` /
`*_null_const` cases in `test_regexp_invalid_pattern`.
--
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]