From 6f1687708cc624c67cb8691dc2972fd9c038de85 Mon Sep 17 00:00:00 2001 From: liutang123 Date: Thu, 19 Sep 2024 19:22:41 +0800 Subject: [PATCH] disable hyperscan because bug --- be/src/vec/functions/function_jsonb.cpp | 7 ++++--- be/src/vec/functions/like.cpp | 5 +++-- be/src/vec/functions/like.h | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/be/src/vec/functions/function_jsonb.cpp b/be/src/vec/functions/function_jsonb.cpp index e98fe30e105ef1c..f0e60602752d562 100644 --- a/be/src/vec/functions/function_jsonb.cpp +++ b/be/src/vec/functions/function_jsonb.cpp @@ -1593,8 +1593,8 @@ class FunctionJsonSearch : public IFunction { state_ptr = std::make_shared(); state_ptr->is_like_pattern = true; const auto& search_str = col_search_string->get_data_at(i); - RETURN_IF_ERROR( - FunctionLike::construct_like_const_state(context, search_str, state_ptr)); + RETURN_IF_ERROR(FunctionLike::construct_like_const_state(context, search_str, + state_ptr, false)); state = state_ptr.get(); } @@ -1647,7 +1647,8 @@ class FunctionJsonSearch : public IFunction { state->is_like_pattern = true; const auto pattern_col = context->get_constant_col(2)->column_ptr; const auto& pattern = pattern_col->get_data_at(0); - RETURN_IF_ERROR(FunctionLike::construct_like_const_state(context, pattern, state)); + RETURN_IF_ERROR(FunctionLike::construct_like_const_state( + context, pattern, state, false)); context->set_function_state(scope, state); } return Status::OK(); diff --git a/be/src/vec/functions/like.cpp b/be/src/vec/functions/like.cpp index c85289a0cef7e59..f56c24f50eef747 100644 --- a/be/src/vec/functions/like.cpp +++ b/be/src/vec/functions/like.cpp @@ -814,7 +814,8 @@ void verbose_log_match(const std::string& str, const std::string& pattern_name, } Status FunctionLike::construct_like_const_state(FunctionContext* context, const StringRef& pattern, - std::shared_ptr& state) { + std::shared_ptr& state, + bool try_hyperscan) { std::string pattern_str = pattern.to_string(); state->search_state.pattern_str = pattern_str; std::string search_string; @@ -886,7 +887,7 @@ Status FunctionLike::construct_like_const_state(FunctionContext* context, const hs_database_t* database = nullptr; hs_scratch_t* scratch = nullptr; - if (hs_prepare(context, re_pattern.c_str(), &database, &scratch).ok()) { + if (try_hyperscan && hs_prepare(context, re_pattern.c_str(), &database, &scratch).ok()) { // use hyperscan state->search_state.hs_database.reset(database); state->search_state.hs_scratch.reset(scratch); diff --git a/be/src/vec/functions/like.h b/be/src/vec/functions/like.h index 4cff41dc815a8e1..13400ff450c089c 100644 --- a/be/src/vec/functions/like.h +++ b/be/src/vec/functions/like.h @@ -256,8 +256,9 @@ class FunctionLike : public FunctionLikeBase { Status open(FunctionContext* context, FunctionContext::FunctionStateScope scope) override; - static Status construct_like_const_state(FunctionContext*, const StringRef&, - std::shared_ptr&); + static Status construct_like_const_state(FunctionContext* ctx, const StringRef& pattern, + std::shared_ptr& state, + bool try_hyperscan = true); friend struct LikeSearchState; friend struct VectorAllpassSearchState;