mrhhsg commented on code in PR #63389:
URL: https://github.com/apache/doris/pull/63389#discussion_r3330511846
##########
be/src/storage/segment/segment.cpp:
##########
@@ -85,6 +89,87 @@ namespace doris::segment_v2 {
class InvertedIndexIterator;
+namespace {
+
+Status build_segment_zonemap_context(Segment* segment, const Schema& schema,
+ const StorageReadOptions& read_options,
+ const VExprContextSPtrs& conjuncts,
ZoneMapEvalContext* ctx) {
+ DORIS_CHECK(segment != nullptr);
+ DORIS_CHECK(ctx != nullptr);
+ std::set<int> slot_indexes;
+ for (const auto& conjunct : conjuncts) {
+ if (conjunct->root() != nullptr) {
Review Comment:
已在 cc67a753274 中处理:这里没有合理的空 root 场景,已把防御式 if 改为 `DORIS_CHECK(conjunct !=
nullptr)` / `DORIS_CHECK(root != nullptr)`,只断言内部不变量。
##########
be/src/storage/segment/segment.cpp:
##########
@@ -85,6 +89,87 @@ namespace doris::segment_v2 {
class InvertedIndexIterator;
+namespace {
+
+Status build_segment_zonemap_context(Segment* segment, const Schema& schema,
+ const StorageReadOptions& read_options,
+ const VExprContextSPtrs& conjuncts,
ZoneMapEvalContext* ctx) {
+ DORIS_CHECK(segment != nullptr);
+ DORIS_CHECK(ctx != nullptr);
+ std::set<int> slot_indexes;
+ for (const auto& conjunct : conjuncts) {
+ if (conjunct->root() != nullptr) {
+ conjunct->root()->collect_slot_column_ids(slot_indexes);
+ }
+ }
+ for (const int slot_index : slot_indexes) {
+ if (slot_index < 0 || cast_set<size_t>(slot_index) >=
schema.num_column_ids()) {
+ continue;
+ }
+ const auto column_id = schema.column_id(cast_set<size_t>(slot_index));
+ const auto* field = schema.column(column_id);
+ if (field == nullptr) {
Review Comment:
已在 cc67a753274 中处理:slot index 已按 `schema.num_column_ids()`
做边界检查,`schema.column(column_id)` 正常不应为空;这里已改成 `DORIS_CHECK(field !=
nullptr)`,不再做重复的防御式 continue。
##########
be/src/storage/segment/segment.cpp:
##########
@@ -85,6 +89,87 @@ namespace doris::segment_v2 {
class InvertedIndexIterator;
+namespace {
+
+Status build_segment_zonemap_context(Segment* segment, const Schema& schema,
+ const StorageReadOptions& read_options,
+ const VExprContextSPtrs& conjuncts,
ZoneMapEvalContext* ctx) {
+ DORIS_CHECK(segment != nullptr);
+ DORIS_CHECK(ctx != nullptr);
+ std::set<int> slot_indexes;
+ for (const auto& conjunct : conjuncts) {
+ if (conjunct->root() != nullptr) {
+ conjunct->root()->collect_slot_column_ids(slot_indexes);
+ }
+ }
+ for (const int slot_index : slot_indexes) {
Review Comment:
已在 cc67a753274 中处理:segment-level context 构建现在先检查
`root->can_evaluate_zonemap_filter()`,并且只收集 slot 依赖数为 1 的表达式;多 slot/unsupported
expression 不再触发无意义的 segment zonemap 读取。
--
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]