Skip to content

Commit

Permalink
fix numProbedBuckets (#10433)
Browse files Browse the repository at this point in the history
Summary:
When searching for keys in a bucket, if the tag hits multiple keys, the accumulation logic of numProbedBucket may be wrong.

Pull Request resolved: #10433

Reviewed By: Yuhta

Differential Revision: D59872520

Pulled By: kevinwilfong

fbshipit-source-id: 2995fcfe97ea1734478a4552c0bb366a5611fe98
  • Loading branch information
skadilover authored and facebook-github-bot committed Jul 18, 2024
1 parent 7fc041c commit 09e1b0d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions velox/exec/HashTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ class ProbeState {
return group_;
}
const auto kEmptyGroup = BaseHashTable::TagVector::broadcast(kEmptyTag);
for (int64_t numProbedBuckets = 0; numProbedBuckets < table.numBuckets();
++numProbedBuckets) {
int64_t numProbedBuckets = 0;
while (numProbedBuckets < table.numBuckets()) {
if (!hits_) {
const uint16_t empty = simd::toBitMask(tagsInTable_ == kEmptyGroup);
if (empty) {
Expand All @@ -248,6 +248,7 @@ class ProbeState {
continue;
}
bucketOffset_ = table.nextBucketOffset(bucketOffset_);
++numProbedBuckets;
tagsInTable_ = BaseHashTable::loadTags(
reinterpret_cast<uint8_t*>(table.table_), bucketOffset_);
hits_ = simd::toBitMask(tagsInTable_ == wantedTags_) & kFullMask;
Expand Down

0 comments on commit 09e1b0d

Please sign in to comment.