github-actions[bot] commented on code in PR #67180:
URL: https://github.com/apache/doris/pull/67180#discussion_r4092358620


##########
be/src/storage/segment/segment_iterator.cpp:
##########
@@ -820,6 +815,38 @@ Status 
SegmentIterator::_get_row_ranges_by_column_conditions() {
         return Status::OK();
     }
 
+    // Apply stable scan restrictions before evaluating inverted-index 
expressions so
+    // selective restrictions can also serve as phrase-query candidates. The 
candidate
+    // pointer keeps referring to _row_bitmap as later predicates shrink it.
+    auto delete_bitmap_it = _opts.delete_bitmap.find(segment_id());
+    if (delete_bitmap_it != _opts.delete_bitmap.end() && 
delete_bitmap_it->second != nullptr) {
+        size_t pre_size = _row_bitmap.cardinality();
+        _row_bitmap -= *delete_bitmap_it->second;
+        _opts.stats->rows_del_by_bitmap += (pre_size - 
_row_bitmap.cardinality());
+        VLOG_DEBUG << "read on segment: " << segment_id()
+                   << ", delete bitmap cardinality: " << 
delete_bitmap_it->second->cardinality()
+                   << ", " << _opts.stats->rows_del_by_bitmap << " rows 
deleted by bitmap";
+    }
+
+    if (!_opts.row_ranges.is_empty()) {
+        _row_bitmap &= RowRanges::ranges_to_roaring(_opts.row_ranges);
+    }
+
+    if (!_row_bitmap.isEmpty() &&

Review Comment:
   [P2] Preserve the old empty-index short circuit when candidate pushdown 
cannot help. This block now runs `_get_row_ranges_from_conditions()` before 
every inverted-index evaluation, so a scan such as `scalar_bloom_predicate AND 
text MATCH_ANY 'absent'` loads the ordinal/bloom metadata before the text index 
proves the segment empty. On the base code that work was after index evaluation 
and skipped for an empty bitmap; the regression remains when 
`inverted_index_candidate_pushdown_ratio=0`, and 
MATCH_ANY/equality/regexp/single-term phrase shapes never consume candidates at 
all. Please gate the early condition pruning on an active candidate-capable 
path, or otherwise retain the old order for disabled/non-consuming scans, with 
a ratio-0 or non-phrase empty-result test.



-- 
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]

Reply via email to