This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch release-2.0.2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 4556bd85404d2727fe979c1a65ec6d6bd6440ea4 Author: zhangstar333 <87313068+zhangstar...@users.noreply.github.com> AuthorDate: Mon Oct 23 15:47:12 2023 +0800 [bug](function) fix regexp_extract_all can't handle empty str (#25717) --- be/src/vec/functions/function_regexp.cpp | 1 + .../sql_functions/string_functions/test_string_function_regexp.out | 6 ++++++ .../string_functions/test_string_function_regexp.groovy | 1 + 3 files changed, 8 insertions(+) diff --git a/be/src/vec/functions/function_regexp.cpp b/be/src/vec/functions/function_regexp.cpp index 31ad61cc187..8cd5b64c71a 100644 --- a/be/src/vec/functions/function_regexp.cpp +++ b/be/src/vec/functions/function_regexp.cpp @@ -361,6 +361,7 @@ struct RegexpExtractAllImpl { } if (res_matches.empty()) { + StringOP::push_empty_string(index_now, result_data, result_offset); return; } diff --git a/regression-test/data/query_p0/sql_functions/string_functions/test_string_function_regexp.out b/regression-test/data/query_p0/sql_functions/string_functions/test_string_function_regexp.out index 1684a03a152..133076ec13b 100644 --- a/regression-test/data/query_p0/sql_functions/string_functions/test_string_function_regexp.out +++ b/regression-test/data/query_p0/sql_functions/string_functions/test_string_function_regexp.out @@ -67,6 +67,12 @@ d -- !sql -- ['ab','c','c','c'] +-- !sql_regexp_extract_all -- + 0 + 0 + 0 + 0 + -- !sql -- a-b-c diff --git a/regression-test/suites/query_p0/sql_functions/string_functions/test_string_function_regexp.groovy b/regression-test/suites/query_p0/sql_functions/string_functions/test_string_function_regexp.groovy index e3e04a5456f..59414f5c1b7 100644 --- a/regression-test/suites/query_p0/sql_functions/string_functions/test_string_function_regexp.groovy +++ b/regression-test/suites/query_p0/sql_functions/string_functions/test_string_function_regexp.groovy @@ -58,6 +58,7 @@ suite("test_string_function_regexp") { qt_sql "select regexp_extract_all('xxfs','f');" qt_sql "select regexp_extract_all('asdfg', '(z|x|c|)');" qt_sql "select regexp_extract_all('abcdfesscca', '(ab|c|)');" + qt_sql_regexp_extract_all "select regexp_extract_all('', '\"([^\"]+)\":'), length(regexp_extract_all('', '\"([^\"]+)\":')) from test_string_function_regexp;" qt_sql "SELECT regexp_replace('a b c', \" \", \"-\");" qt_sql "SELECT regexp_replace('a b c','(b)','<\\\\1>');" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org