github-actions[bot] commented on code in PR #63389:
URL: https://github.com/apache/doris/pull/63389#discussion_r3375052812
##########
be/src/storage/segment/segment_iterator.cpp:
##########
@@ -3411,6 +3447,100 @@ 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();
+ }
+
+ std::unordered_map<int, VExprContextSPtrs> ctxs_by_slot;
+ for (const auto& conjunct : conjuncts) {
+ auto slot_index = single_slot_zonemap_index(conjunct);
+ if (slot_index.has_value() &&
conjunct->root()->can_evaluate_zonemap_filter()) {
Review Comment:
This page-pruning path depends on the `VSlotRef::column_id` values in
`_common_expr_ctxs_push_down`, but those contexts were produced by
`VExprContext::clone()` in `_construct_compound_expr_context()`, which still
shares the same `_root` pointer. `rebind_storage_exprs_to_reader_schema()` then
mutates that shared root via `set_column_id()`. On AGG_KEYS or non-MOW
UNIQUE_KEYS scans with schema-evolution/merge readers, two segment iterators
can rebind the same pushed-down expression tree to different reader schemas;
while this new code is grouping by `single_slot_zonemap_index()` and later
evaluating page zonemaps, another iterator can change the slot id underneath
it. That can make the page-level expr zonemap read a different column's page
zonemap and intersect away rows that actually match.
This is distinct from the existing whole-segment thread: the segment-level
path is now gated by `storage_expr_slots_match_reader_schema()`, but the
iterator-level path added here still runs after shallow-clone rebinding. Please
deep-clone the expression tree before rebinding, or skip this page-level
expr-zonemap path whenever rebinding is required.
--
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]