airborne12 commented on code in PR #48273: URL: https://github.com/apache/doris/pull/48273#discussion_r1978504153
########## be/src/olap/tablet_schema.cpp: ########## @@ -905,18 +905,18 @@ void TabletColumn::append_sparse_column(TabletColumn column) { } void TabletSchema::append_index(TabletIndex&& index) { - _indexes.push_back(std::move(index)); + _indexes.push_back(std::make_shared<TabletIndex>(index)); } void TabletSchema::update_index(const TabletColumn& col, const IndexType& index_type, TabletIndex&& index) { int32_t col_unique_id = col.is_extracted_column() ? col.parent_unique_id() : col.unique_id(); const std::string& suffix_path = escape_for_path_name(col.suffix_path()); - for (size_t i = 0; i < _indexes.size(); i++) { - for (int32_t id : _indexes[i].col_unique_ids()) { - if (_indexes[i].index_type() == index_type && id == col_unique_id && - _indexes[i].get_index_suffix() == suffix_path) { - _indexes[i] = std::move(index); + for (auto& _indexe : _indexes) { + for (int32_t id : _indexe->col_unique_ids()) { + if (_indexe->index_type() == index_type && id == col_unique_id && + _indexe->get_index_suffix() == suffix_path) { + _indexe = std::make_shared<TabletIndex>(index); Review Comment: maybe we can use std::make_shared<TabletIndex>(std::move(index)) to avoid copy cost. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org