Skip to content

Commit

Permalink
disable hyperscan because bug
Browse files Browse the repository at this point in the history
  • Loading branch information
liutang123 authored and liulijia committed Sep 19, 2024
1 parent 847be8d commit 6f16877
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions be/src/vec/functions/function_jsonb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1593,8 +1593,8 @@ class FunctionJsonSearch : public IFunction {
state_ptr = std::make_shared<LikeState>();
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();
}

Expand Down Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions be/src/vec/functions/like.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<LikeState>& state) {
std::shared_ptr<LikeState>& state,
bool try_hyperscan) {
std::string pattern_str = pattern.to_string();
state->search_state.pattern_str = pattern_str;
std::string search_string;
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions be/src/vec/functions/like.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<LikeState>&);
static Status construct_like_const_state(FunctionContext* ctx, const StringRef& pattern,
std::shared_ptr<LikeState>& state,
bool try_hyperscan = true);

friend struct LikeSearchState;
friend struct VectorAllpassSearchState;
Expand Down

0 comments on commit 6f16877

Please sign in to comment.