From a7446fa59e4e04d545300d70e80c9176a47bfd80 Mon Sep 17 00:00:00 2001 From: Kang Date: Tue, 25 Jul 2023 18:00:35 +0800 Subject: [PATCH] [fix](inverted index) make error message more friendly when query token is empty (#22118) --- .../olap/rowset/segment_v2/inverted_index_reader.cpp | 4 +++- be/src/vec/functions/match.cpp | 12 +++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp b/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp index d382d74aab..0b7340bb40 100644 --- a/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp +++ b/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp @@ -244,7 +244,9 @@ Status FullTextIndexReader::query(OlapReaderStatistics* stats, const std::string if (analyse_result.empty()) { return Status::Error( - "invalid input query_str: {}, please check your query sql", search_str); + "token parser result is empty for query, " + "please check your query: '{}' and index parser: '{}'", + search_str, get_parser_string_from_properties(_index_meta.properties())); } std::unique_ptr query; diff --git a/be/src/vec/functions/match.cpp b/be/src/vec/functions/match.cpp index a142d8588c..451455771c 100644 --- a/be/src/vec/functions/match.cpp +++ b/be/src/vec/functions/match.cpp @@ -138,7 +138,9 @@ Status FunctionMatchAny::execute_match(const std::string& column_name, doris::segment_v2::InvertedIndexQueryType::MATCH_ANY_QUERY, inverted_index_ctx); if (query_tokens.empty()) { return Status::Error( - "invalid input query_str: {}, please check your query sql", match_query_str); + "token parser result is empty for query, " + "please check your query: '{}' and index parser: '{}'", + match_query_str, inverted_index_parser_type_to_string(parser_type)); } auto current_src_array_offset = 0; @@ -178,7 +180,9 @@ Status FunctionMatchAll::execute_match(const std::string& column_name, doris::segment_v2::InvertedIndexQueryType::MATCH_ALL_QUERY, inverted_index_ctx); if (query_tokens.empty()) { return Status::Error( - "invalid input query_str: {}, please check your query sql", match_query_str); + "token parser result is empty for query, " + "please check your query: '{}' and index parser: '{}'", + match_query_str, inverted_index_parser_type_to_string(parser_type)); } auto current_src_array_offset = 0; @@ -225,7 +229,9 @@ Status FunctionMatchPhrase::execute_match(const std::string& column_name, inverted_index_ctx); if (query_tokens.empty()) { return Status::Error( - "invalid input query_str: {}, please check your query sql", match_query_str); + "token parser result is empty for query, " + "please check your query: '{}' and index parser: '{}'", + match_query_str, inverted_index_parser_type_to_string(parser_type)); } auto current_src_array_offset = 0;