Skip to content

Commit

Permalink
Fix distinct hash table performance bug (#3350)
Browse files Browse the repository at this point in the history
  • Loading branch information
acquamarin committed Apr 23, 2024
1 parent 41a2468 commit 2f5c63d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/processor/operator/aggregate/aggregate_hash_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ bool AggregateHashTable::isAggregateValueDistinctForGroupByKeys(
}
distinctKeyVectors[groupByFlatKeyVectors.size()] = aggregateVector;
computeVectorHashes(distinctKeyVectors, std::vector<ValueVector*>() /* unFlatKeyVectors */);
hash_t hash = hashVector->getValue<hash_t>(hashVector->state->selVector->selectedPositions[0]);
auto hash = hashVector->getValue<hash_t>(hashVector->state->selVector->selectedPositions[0]);
auto distinctHTEntry = findEntryInDistinctHT(distinctKeyVectors, hash);
if (distinctHTEntry == nullptr) {
resizeHashTableIfNecessary(1);
Expand Down Expand Up @@ -378,6 +378,7 @@ uint8_t* AggregateHashTable::createEntryInDistinctHT(
factorizedTable->updateFlatCell(entry, i, groupByHashKeyVectors[i],
groupByHashKeyVectors[i]->state->selVector->selectedPositions[0]);
}
factorizedTable->updateFlatCellNoNull(entry, hashColIdxInFT, &hash);
fillEntryWithInitialNullAggregateState(entry);
fillHashSlot(hash, entry);
return entry;
Expand Down

0 comments on commit 2f5c63d

Please sign in to comment.