Skip to content

Commit

Permalink
[fix] NullPredicate should implement evaluate_vec (#9689)
Browse files Browse the repository at this point in the history
select column from table where column is null
  • Loading branch information
dataroaring authored and morningman committed May 22, 2022
1 parent b28b77a commit e52e27b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion be/src/olap/column_predicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ class ColumnPredicate {
// used to evaluate pre read column in lazy matertialization
// now only support integer/float
// a vectorized eval way
virtual void evaluate_vec(vectorized::IColumn& column, uint16_t size, bool* flags) const {};
virtual void evaluate_vec(vectorized::IColumn& column, uint16_t size, bool* flags) const {
DCHECK(false) << "should not reach here";
}

uint32_t column_id() const { return _column_id; }

protected:
Expand Down
12 changes: 12 additions & 0 deletions be/src/olap/null_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,16 @@ void NullPredicate::evaluate_and(IColumn& column, uint16_t* sel, uint16_t size,
if (_is_null) memset(flags, false, size);
}
}

void NullPredicate::evaluate_vec(vectorized::IColumn& column, uint16_t size, bool* flags) const {
if (auto* nullable = check_and_get_column<ColumnNullable>(column)) {
auto& null_map = nullable->get_null_map_data();
for (uint16_t i = 0; i < size; ++i) {
flags[i] = (null_map[i] == _is_null);
}
} else {
if (_is_null) memset(flags, false, size);
}
}

} //namespace doris
2 changes: 2 additions & 0 deletions be/src/olap/null_predicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class NullPredicate : public ColumnPredicate {
void evaluate_and(vectorized::IColumn& column, uint16_t* sel, uint16_t size,
bool* flags) const override;

void evaluate_vec(vectorized::IColumn& column, uint16_t size, bool* flags) const override;

private:
bool _is_null; //true for null, false for not null
};
Expand Down

0 comments on commit e52e27b

Please sign in to comment.