This is an automated email from the ASF dual-hosted git repository.

panxiaolei pushed a commit to branch tpc_preview2
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/tpc_preview2 by this push:
     new ed2028dfce6 rf (#58468)
ed2028dfce6 is described below

commit ed2028dfce6cc717b86288334a17dc12d30f328a
Author: Mryange <[email protected]>
AuthorDate: Thu Nov 27 19:11:41 2025 +0800

    rf (#58468)
    
    ### What problem does this PR solve?
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 be/src/olap/column_predicate.h                     | 10 ++++++++--
 be/src/olap/comparison_predicate.h                 |  1 +
 be/src/olap/rowset/segment_v2/segment_iterator.cpp |  2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/be/src/olap/column_predicate.h b/be/src/olap/column_predicate.h
index 81afb22936d..431c039dfc1 100644
--- a/be/src/olap/column_predicate.h
+++ b/be/src/olap/column_predicate.h
@@ -25,6 +25,7 @@
 #include "olap/rowset/segment_v2/bloom_filter.h"
 #include "olap/rowset/segment_v2/inverted_index_iterator.h"
 #include "runtime/define_primitive_type.h"
+#include "util/defer_op.h"
 #include "util/runtime_profile.h"
 #include "vec/columns/column.h"
 #include "vec/exec/format/parquet/parquet_predicate.h"
@@ -186,6 +187,8 @@ public:
     // evaluate predicate on IColumn
     // a short circuit eval way
     uint16_t evaluate(const vectorized::IColumn& column, uint16_t* sel, 
uint16_t size) const {
+        Defer defer([&] { try_reset_judge_selectivity(); });
+
         if (always_true()) {
             return size;
         }
@@ -347,10 +350,13 @@ protected:
         _judge_filter_rows = 0;
     }
 
-    void do_judge_selectivity(uint64_t filter_rows, uint64_t input_rows) const 
{
-        if ((_judge_counter--) == 0) {
+    void try_reset_judge_selectivity() const {
+        if (_can_ignore() && (_judge_counter == 0)) {
             reset_judge_selectivity();
         }
+    }
+
+    void do_judge_selectivity(uint64_t filter_rows, uint64_t input_rows) const 
{
         if (!_always_true) {
             _judge_filter_rows += filter_rows;
             _judge_input_rows += input_rows;
diff --git a/be/src/olap/comparison_predicate.h 
b/be/src/olap/comparison_predicate.h
index a22ba6ebe78..f89437bdf95 100644
--- a/be/src/olap/comparison_predicate.h
+++ b/be/src/olap/comparison_predicate.h
@@ -370,6 +370,7 @@ public:
         Defer defer([&]() {
             update_filter_info(current_evaluated_rows - current_passed_rows,
                                current_evaluated_rows);
+            try_reset_judge_selectivity();
         });
 
         if (column.is_nullable()) {
diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp 
b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index 7102e8b5cdb..e92f4c37ab4 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -2259,7 +2259,7 @@ uint16_t 
SegmentIterator::_evaluate_vectorization_predicate(uint16_t* sel_rowid_
     }
     if (all_pred_always_true) {
         for (const auto& pred : _pre_eval_block_predicate) {
-            pred->always_true();
+            DCHECK(pred->always_true());
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to