forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
Description
facebookincubator#12659
The toValues function in velox/functions/prestosql/InPredicate.cpp de-duplicates values in vector, and extract a bool to indicate if there are nulls. It uses the following loop:
for (auto i = offset; i < offset + size; i++) {
if (simpleValues->isNullAt(i)) {
hasNull = true;
} else {
if constexpr (std::is_same_v<U, Timestamp>) {
values.emplace_back(simpleValues->valueAt(i).toMillis());
} else {
values.emplace_back(simpleValues->valueAt(i));
}
}
}
This loop can be improved when simpleValues->mayHaveNulls() is false. In such case we can separate the loops into two loops. We also want to add a micro-benchmark for it.