From d431a357216b2d8c1ee1a8f28611d8f72081a79c Mon Sep 17 00:00:00 2001 From: airborne12 Date: Tue, 15 Aug 2023 11:27:12 +0800 Subject: [PATCH] [Fix](inverted index) fix non-index match function core (#22959) --- be/src/vec/exprs/vmatch_predicate.cpp | 2 +- be/src/vec/functions/match.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/be/src/vec/exprs/vmatch_predicate.cpp b/be/src/vec/exprs/vmatch_predicate.cpp index a06d248979f9f0..3eee50c974046f 100644 --- a/be/src/vec/exprs/vmatch_predicate.cpp +++ b/be/src/vec/exprs/vmatch_predicate.cpp @@ -87,7 +87,7 @@ Status VMatchPredicate::open(RuntimeState* state, VExprContext* context, FunctionContext::FunctionStateScope scope) { RETURN_IF_ERROR(VExpr::open(state, context, scope)); RETURN_IF_ERROR(VExpr::init_function_context(context, scope, _function)); - if (scope == FunctionContext::THREAD_LOCAL) { + if (scope == FunctionContext::THREAD_LOCAL || scope == FunctionContext::FRAGMENT_LOCAL) { context->fn_context(_fn_context_index)->set_function_state(scope, _inverted_index_ctx); } return Status::OK(); diff --git a/be/src/vec/functions/match.cpp b/be/src/vec/functions/match.cpp index 3c476993694e43..bba640fa9fd49e 100644 --- a/be/src/vec/functions/match.cpp +++ b/be/src/vec/functions/match.cpp @@ -34,6 +34,10 @@ Status FunctionMatchBase::execute_impl(FunctionContext* context, Block& block, << ", match_query_str=" << match_query_str; InvertedIndexCtx* inverted_index_ctx = reinterpret_cast( context->get_function_state(FunctionContext::THREAD_LOCAL)); + if (inverted_index_ctx == nullptr) { + inverted_index_ctx = reinterpret_cast( + context->get_function_state(FunctionContext::FRAGMENT_LOCAL)); + } const ColumnPtr source_col = block.get_by_position(arguments[0]).column->convert_to_full_column_if_const();