yiguolei commented on code in PR #63389:
URL: https://github.com/apache/doris/pull/63389#discussion_r3451574594
##########
be/src/storage/segment/segment_iterator.cpp:
##########
@@ -3400,6 +3419,107 @@ Status
SegmentIterator::_construct_compound_expr_context() {
return Status::OK();
}
+Status SegmentIterator::_apply_expr_zonemap_to_row_ranges(const
VExprContextSPtrs& conjuncts,
+ rowid_t min_rowid,
+ RowRanges*
row_ranges) {
+ DORIS_CHECK(row_ranges != nullptr);
+ if (!expr_zonemap::is_expr_zonemap_filter_enabled(_opts.runtime_state) ||
conjuncts.empty() ||
+ row_ranges->is_empty()) {
+ return Status::OK();
+ }
+ // Page zone maps are addressed by reader-schema column ordinals. When
storage expr slots need
+ // rebinding to the reader schema, VExprContext::clone() does not
deep-copy the expression tree
+ // yet, so rebinding may mutate shared slot refs. Keep page-level
expr-zonemap on layouts whose
+ // scan tuple slot ordinals already match the reader schema.
+ if (!storage_expr_slots_match_reader_schema(_opts)) {
+ return Status::OK();
+ }
+
+ std::unordered_map<int, VExprContextSPtrs> ctxs_by_slot;
+ for (const auto& conjunct : conjuncts) {
+ auto slot_index = expr_zonemap::single_slot_zonemap_index(conjunct);
+ if (slot_index.has_value()) {
+ ctxs_by_slot[*slot_index].emplace_back(conjunct);
+ }
+ }
+ // Page zone maps are stored per column. Multi-slot expressions need page
alignment across
+ // multiple column readers and are therefore left to segment-level pruning
for now.
+ if (ctxs_by_slot.empty()) {
+ return Status::OK();
+ }
+
+ ColumnIteratorOptions iter_opts {
+ .use_page_cache = _opts.use_page_cache,
+ .file_reader = _file_reader.get(),
+ .stats = _opts.stats,
+ .io_ctx = _opts.io_ctx,
+ };
+ for (const auto& [slot_index, slot_conjuncts] : ctxs_by_slot) {
+ if (cast_set<size_t>(slot_index) >= _schema->num_column_ids()) {
+ continue;
+ }
+ const auto cid = _schema->column_id(cast_set<size_t>(slot_index));
+ if (!_segment->can_apply_predicate_safely(cid, *_schema,
+
_opts.target_cast_type_for_variants, _opts)) {
+ continue;
+ }
+ const auto* field = _schema->column(cid);
Review Comment:
这应该是tablet column 不是field
--
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]