From 1260fca5a34b58b8f4275049622b0df77861753b Mon Sep 17 00:00:00 2001 From: qidaye Date: Thu, 20 Feb 2025 20:08:54 +0800 Subject: [PATCH] [opt](Inverted index)Avoid repeated calculations of suffix paths (#48137) --- be/src/olap/tablet_schema.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/be/src/olap/tablet_schema.cpp b/be/src/olap/tablet_schema.cpp index 488e9755b239ea..a1549c255d19f0 100644 --- a/be/src/olap/tablet_schema.cpp +++ b/be/src/olap/tablet_schema.cpp @@ -1411,11 +1411,11 @@ const TabletIndex* TabletSchema::get_inverted_index_with_index_id( const TabletIndex* TabletSchema::get_inverted_index(int32_t col_unique_id, const std::string& suffix_path) const { + const std::string escaped_suffix = escape_for_path_name(suffix_path); for (size_t i = 0; i < _indexes.size(); i++) { if (_indexes[i].index_type() == IndexType::INVERTED) { for (int32_t id : _indexes[i].col_unique_ids()) { - if (id == col_unique_id && - _indexes[i].get_index_suffix() == escape_for_path_name(suffix_path)) { + if (id == col_unique_id && _indexes[i].get_index_suffix() == escaped_suffix) { return &(_indexes[i]); } }