Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions be/src/olap/column_predicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -186,6 +187,8 @@ class ColumnPredicate {
// 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;
}
Expand Down Expand Up @@ -351,10 +354,13 @@ class ColumnPredicate {
_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)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why reset judge selectivity need _can_ignore()

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;
Expand Down
1 change: 1 addition & 0 deletions be/src/olap/comparison_predicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ class ComparisonPredicateBase : public ColumnPredicate {
Defer defer([&]() {
update_filter_info(current_evaluated_rows - current_passed_rows,
current_evaluated_rows);
try_reset_judge_selectivity();
});

if (column.is_nullable()) {
Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/rowset/segment_v2/segment_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,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());
}
}

Expand Down
Loading