Skip to content

Commit

Permalink
[opt]Avoid repeated calculations of suffix paths
Browse files Browse the repository at this point in the history
  • Loading branch information
qidaye committed Feb 20, 2025
1 parent 1e875e4 commit c127179
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions be/src/olap/tablet_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,11 +1407,11 @@ bool TabletSchema::has_inverted_index_with_index_id(int64_t index_id) const {

const TabletIndex* TabletSchema::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]);
}
}
Expand Down

0 comments on commit c127179

Please sign in to comment.