This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 52460af74b [Bug][Vectorized] Support the .* in hyperscan to valid the
% in SQL (#11371)
52460af74b is described below
commit 52460af74bb2a95f5fd871d9330a6f9a7aee8d28
Author: HappenLee <[email protected]>
AuthorDate: Mon Aug 1 11:00:05 2022 +0800
[Bug][Vectorized] Support the .* in hyperscan to valid the % in SQL (#11371)
Co-authored-by: lihaopeng <[email protected]>
---
be/src/vec/functions/like.cpp | 11 +++++++----
.../string_functions/test_string_function_like.out | 11 +++++++++++
.../string_functions/test_string_function_like.groovy | 3 +++
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/be/src/vec/functions/like.cpp b/be/src/vec/functions/like.cpp
index 8f84c0f21b..6e9b810ae1 100644
--- a/be/src/vec/functions/like.cpp
+++ b/be/src/vec/functions/like.cpp
@@ -117,12 +117,15 @@ Status FunctionLikeBase::regexp_fn(LikeSearchState*
state, const StringValue& va
Status FunctionLikeBase::hs_prepare(FunctionContext* context, const char*
expression,
hs_database_t** database, hs_scratch_t**
scratch) {
hs_compile_error_t* compile_err;
- if (hs_compile(expression, HS_FLAG_DOTALL, HS_MODE_BLOCK, NULL, database,
&compile_err) !=
- HS_SUCCESS) {
- hs_free_compile_error(compile_err);
+
+ if (hs_compile(expression, HS_FLAG_DOTALL | HS_FLAG_ALLOWEMPTY,
HS_MODE_BLOCK, NULL, database,
+ &compile_err) != HS_SUCCESS) {
*database = nullptr;
if (context) context->set_error("hs_compile regex pattern error");
- return Status::RuntimeError("hs_compile regex pattern error");
+ auto status = Status::RuntimeError("hs_compile regex pattern error:" +
+ std::string(compile_err->message));
+ hs_free_compile_error(compile_err);
+ return status;
}
hs_free_compile_error(compile_err);
diff --git
a/regression-test/data/query/sql_functions/string_functions/test_string_function_like.out
b/regression-test/data/query/sql_functions/string_functions/test_string_function_like.out
index f307b72ee9..609fceed20 100644
---
a/regression-test/data/query/sql_functions/string_functions/test_string_function_like.out
+++
b/regression-test/data/query/sql_functions/string_functions/test_string_function_like.out
@@ -87,3 +87,14 @@ ba
bab
bb
+-- !sql --
+a
+ab
+accb
+b
+ba
+bab
+bb
+
+-- !sql --
+
diff --git
a/regression-test/suites/query/sql_functions/string_functions/test_string_function_like.groovy
b/regression-test/suites/query/sql_functions/string_functions/test_string_function_like.groovy
index 80d3ea0bbc..8ab600d175 100644
---
a/regression-test/suites/query/sql_functions/string_functions/test_string_function_like.groovy
+++
b/regression-test/suites/query/sql_functions/string_functions/test_string_function_like.groovy
@@ -57,5 +57,8 @@ suite("test_string_function_like", "query") {
qt_sql "SELECT k FROM ${tbName} WHERE k NOT LIKE \"_a_\" ORDER BY k;"
qt_sql "SELECT k FROM ${tbName} WHERE k NOT LIKE \"a__b\" ORDER BY k;"
+ qt_sql "SELECT k FROM ${tbName} WHERE k LIKE \"%\" ORDER BY k;"
+ qt_sql "SELECT k FROM ${tbName} WHERE k NOT LIKE \"%\" ORDER BY k;"
+
sql "DROP TABLE ${tbName};"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]