yiguolei commented on code in PR #57702: URL: https://github.com/apache/doris/pull/57702#discussion_r2558773209
########## be/src/olap/rowset/segment_v2/column_meta_accessor.h: ########## @@ -0,0 +1,55 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <functional> +#include <memory> +#include <unordered_map> + +#include "common/status.h" +#include "gen_cpp/segment_v2.pb.h" +#include "io/fs/file_reader.h" + +namespace doris::segment_v2 { + +// Centralized accessor for column metadata layout of a Segment. +// It selects V2 (inline footer.columns) or V3 (external Column Meta Region) +// implementation internally and exposes a unified API to callers. +class ColumnMetaAccessor { +public: + class Impl; + ColumnMetaAccessor() = default; + ~ColumnMetaAccessor(); + + // Initialize accessor and choose V2 / V3 implementation based on footer. + Status init(const SegmentFooterPB& footer, io::FileReaderSPtr file_reader); + + // Build uid -> col_id mapping. + Status build_uid_to_colid_map(std::unordered_map<int32_t, size_t>* uid_to_colid) const; + + // Get ColumnMetaPB for the given column_id. + Status get_column_meta(uint32_t column_id, ColumnMetaPB* out) const; Review Comment: Status get_column_meta_by_uniqueid(uint32_t column_unique_id, ColumnMetaPB* out) const; Status get_column_meta_by_id(uint32_t column_ordinal, ColumnMetaPB* out) const; -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
