This is an automated email from the ASF dual-hosted git repository.
lihaopeng pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 1c55cf8d2b1 [bug](regexp) fix regexp function fallback to re2 failed
(#34292)
1c55cf8d2b1 is described below
commit 1c55cf8d2b15c5bac77c24122dd63ed4706f836e
Author: zhangstar333 <[email protected]>
AuthorDate: Tue Apr 30 10:50:03 2024 +0800
[bug](regexp) fix regexp function fallback to re2 failed (#34292)
---
be/src/vec/functions/like.cpp | 11 +++--------
.../string_functions/test_string_function_regexp.out | 2 ++
.../string_functions/test_string_function_regexp.groovy | 2 ++
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/be/src/vec/functions/like.cpp b/be/src/vec/functions/like.cpp
index ef89ed694c2..784dc51990d 100644
--- a/be/src/vec/functions/like.cpp
+++ b/be/src/vec/functions/like.cpp
@@ -296,12 +296,10 @@ Status FunctionLikeBase::hs_prepare(FunctionContext*
context, const char* expres
if (res != HS_SUCCESS) {
*database = nullptr;
- if (context) {
- context->set_error("hs_compile regex pattern error");
- }
- return Status::RuntimeError("hs_compile regex pattern error:" +
- std::string(compile_err->message));
+ auto error_msg = fmt::format("hs_compile regex pattern={}, error
msg={}", expression,
+ compile_err->message);
hs_free_compile_error(compile_err);
+ return Status::RuntimeError(error_msg);
}
hs_free_compile_error(compile_err);
@@ -309,9 +307,6 @@ Status FunctionLikeBase::hs_prepare(FunctionContext*
context, const char* expres
hs_free_database(*database);
*database = nullptr;
*scratch = nullptr;
- if (context) {
- context->set_error("hs_alloc_scratch allocate scratch space
error");
- }
return Status::RuntimeError("hs_alloc_scratch allocate scratch space
error");
}
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 cfe2fd3eaf7..6cead424968 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
@@ -21,6 +21,8 @@ Emmy eillish
It's true
billie eillish
+-- !sql --
+
-- !sql --
billie eillish
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 d25c995ea48..49e6d57539f 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
@@ -40,6 +40,8 @@ suite("test_string_function_regexp") {
qt_sql "SELECT k FROM ${tbName} WHERE k not regexp '^billie' ORDER BY k;"
qt_sql "SELECT k FROM ${tbName} WHERE k not regexp 'ok\$' ORDER BY k;"
+ qt_sql "SELECT k FROM ${tbName} where (k regexp
'[0]^[0-9]+.{0,1}[0-9]+\$') = 1;"
+
// regexp as function
qt_sql "SELECT k FROM ${tbName} WHERE regexp(k, '^billie') ORDER BY k;"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]