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

Improve toValues() function performance #12659

Open
yingsu00 opened this issue Mar 15, 2025 · 0 comments
Open

Improve toValues() function performance #12659

yingsu00 opened this issue Mar 15, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@yingsu00
Copy link
Collaborator

Description

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant