This is an automated email from the ASF dual-hosted git repository.
lihaopeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new b8452812dff [bug](function) fix regexp_extract_all can't handle empty
str (#25717)
b8452812dff is described below
commit b8452812dffbf39104ca1f1c5053dc9951dfa23a
Author: zhangstar333 <[email protected]>
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 1a38fe741e9..4da133a6f51 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: [email protected]
For additional commands, e-mail: [email protected]