Vectorize filter generation of ColumnNullable in FilterDescription (#45962)

This commit achieved the data parallelism for filter generations of
the nullable columns by replacing the logical AND operator with the
bitwise one, which could be auto-vectorized by the compiler.
This commit is contained in:
Zhiguo Zhou 2023-02-07 23:33:01 +08:00 committed by GitHub
parent 52d4e78b7f
commit b43ffb98e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,7 +82,12 @@ FilterDescription::FilterDescription(const IColumn & column_)
const auto size = res.size();
assert(size == null_map.size());
for (size_t i = 0; i < size; ++i)
res[i] = res[i] && !null_map[i];
{
auto has_val = static_cast<UInt8>(!!res[i]);
auto not_null = static_cast<UInt8>(!null_map[i]);
/// Instead of the logical AND operator(&&), the bitwise one(&) is utilized for the auto vectorization.
res[i] = has_val & not_null;
}
data = &res;
data_holder = std::move(mutable_holder);