Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] NullPredicate should implement evaluate_vec #9689

Merged
merged 3 commits into from
May 22, 2022
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
5 changes: 4 additions & 1 deletion be/src/olap/column_predicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,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 @@ -52,6 +52,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