yiguolei commented on code in PR #51271:
URL: https://github.com/apache/doris/pull/51271#discussion_r2119313903
##########
be/src/olap/rowset/segment_v2/segment.cpp:
##########
@@ -1231,4 +1233,59 @@ StoragePageCache::CacheKey
Segment::get_segment_footer_cache_key() const {
_file_reader->size() - 12);
}
+std::map<uint32_t, Segment::ZoneMapInfo> Segment::get_zone_maps() {
+ if (config::cache_zone_map_max_columns_count <= 0) {
+ return {};
+ }
+
+ std::shared_ptr<SegmentFooterPB> footer_pb;
+ try {
+ auto st = _get_segment_footer(footer_pb, nullptr);
+ if (!st.ok()) {
+ LOG(INFO) << "cannot get footer from segment: " << _segment_id
+ << ", rowset: " << _rowset_id << ", error: " <<
st.to_string();
+ return {};
+ }
+ } catch (const std::exception& e) {
+ LOG(WARNING) << "Failed to get segment footer for segment: " <<
_segment_id
+ << ", rowset: " << _rowset_id << ", error: " << e.what();
+ return {};
+ }
+
+ std::map<uint32_t, ZoneMapInfo> zone_maps;
+
+ const auto& schema_columns = _tablet_schema->columns();
+ const auto pb_columns_count = footer_pb->columns().size();
+ if (pb_columns_count <= 0) {
+ return {};
+ }
+
+ const auto columns_count =
+ std::min(std::min(schema_columns.size(),
static_cast<size_t>(pb_columns_count)),
+
static_cast<size_t>(config::cache_zone_map_max_columns_count));
+
+ for (size_t ordinal = 0; ordinal != columns_count; ++ordinal) {
+ const auto& column_pb = footer_pb->columns(ordinal);
+ const auto& column = _tablet_schema->column(ordinal);
+ if (column.unique_id() < 0 || column.unique_id() !=
column_pb.unique_id()) {
+ VLOG_DEBUG << "skip zone map for unmatched col id: " <<
column.unique_id() << " : "
+ << column_pb.unique_id() << ", column name: " <<
column.name();
+ continue;
Review Comment:
此时,也应该return errorstatus,并且打印warning log,表示出现了一个异常情况。
--
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]