From 0e248e359458a217b8b0932401f7c71c15331edd Mon Sep 17 00:00:00 2001 From: zzzxl <33418555+zzzxl1993@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:04:36 +0800 Subject: [PATCH] [fix](inverted index) Corrected the issue of no_index_match failure caused by empty data #37947 (#38002) --- be/src/vec/functions/match.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/be/src/vec/functions/match.cpp b/be/src/vec/functions/match.cpp index eb4c1e3554..95e973ae61 100644 --- a/be/src/vec/functions/match.cpp +++ b/be/src/vec/functions/match.cpp @@ -366,7 +366,12 @@ Status FunctionMatchPhrasePrefix::execute_match( analyse_data_token(column_name, inverted_index_ctx, string_col, i, array_offsets, current_src_array_offset); - for (size_t j = 0; j < data_tokens.size() - query_tokens.size() + 1; j++) { + int32_t dis_count = data_tokens.size() - query_tokens.size(); + if (dis_count < 0) { + continue; + } + + for (size_t j = 0; j < dis_count + 1; j++) { if (data_tokens[j] == query_tokens[0] || query_tokens.size() == 1) { bool match = true; for (size_t k = 0; k < query_tokens.size(); k++) {