From dcb70e053bb1f04f52f69b725fce28b2cbe01698 Mon Sep 17 00:00:00 2001 From: lihangyu <15605149486@163.com> Date: Mon, 11 Nov 2024 17:39:04 +0800 Subject: [PATCH] [opt](Variant) avoid unnecessary mem for variant extracted columns (#43567) _field_name_to_index and _field_id_to_index is unnecessary for variant subcolumns, since they use column path as identifier --- be/src/olap/tablet_schema.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/be/src/olap/tablet_schema.cpp b/be/src/olap/tablet_schema.cpp index ef0ff5120396c6..7e83e15eac4cf6 100644 --- a/be/src/olap/tablet_schema.cpp +++ b/be/src/olap/tablet_schema.cpp @@ -993,9 +993,12 @@ void TabletSchema::init_from_pb(const TabletSchemaPB& schema, bool ignore_extrac if (column->is_variant_type()) { ++_num_variant_columns; } + _cols.emplace_back(std::move(column)); - _field_name_to_index.emplace(StringRef(_cols.back()->name()), _num_columns); - _field_id_to_index[_cols.back()->unique_id()] = _num_columns; + if (!_cols.back()->is_extracted_column()) { + _field_name_to_index.emplace(StringRef(_cols.back()->name()), _num_columns); + _field_id_to_index[_cols.back()->unique_id()] = _num_columns; + } _num_columns++; } for (auto& index_pb : schema.index()) {