diff --git a/be/src/vec/functions/function_regexp.cpp b/be/src/vec/functions/function_regexp.cpp index 1a38fe741e..4da133a6f5 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 1684a03a15..133076ec13 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 e3e04a5456..59414f5c1b 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>');"