Skip to content

Commit

Permalink
disable hyperscan because bug
Browse files Browse the repository at this point in the history
  • Loading branch information
liutang123 committed Sep 19, 2024
1 parent c668be6 commit 79abcd0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions be/src/vec/functions/function_jsonb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1765,8 +1765,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 @@ -1819,7 +1819,7 @@ 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 @@ -817,7 +817,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 @@ -889,7 +890,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 79abcd0

Please sign in to comment.