From 13d4b5d4e8fdfc85c503201de13aa7fc9b74903a Mon Sep 17 00:00:00 2001 From: ziyi chen Date: Tue, 23 Apr 2024 14:19:27 +0800 Subject: [PATCH 1/2] Fix distinct hash table performance bug --- src/processor/operator/aggregate/aggregate_hash_table.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/processor/operator/aggregate/aggregate_hash_table.cpp b/src/processor/operator/aggregate/aggregate_hash_table.cpp index 51ddac8a72..418ce77d6f 100644 --- a/src/processor/operator/aggregate/aggregate_hash_table.cpp +++ b/src/processor/operator/aggregate/aggregate_hash_table.cpp @@ -1,5 +1,7 @@ #include "processor/operator/aggregate/aggregate_hash_table.h" +#include + #include "common/utils.h" using namespace kuzu::common; @@ -49,7 +51,7 @@ bool AggregateHashTable::isAggregateValueDistinctForGroupByKeys( } distinctKeyVectors[groupByFlatKeyVectors.size()] = aggregateVector; computeVectorHashes(distinctKeyVectors, std::vector() /* unFlatKeyVectors */); - hash_t hash = hashVector->getValue(hashVector->state->selVector->selectedPositions[0]); + auto hash = hashVector->getValue(hashVector->state->selVector->selectedPositions[0]); auto distinctHTEntry = findEntryInDistinctHT(distinctKeyVectors, hash); if (distinctHTEntry == nullptr) { resizeHashTableIfNecessary(1); @@ -378,6 +380,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; From 98a80a18aaf3e47a0624de917c0ac81eea88164c Mon Sep 17 00:00:00 2001 From: ziyi chen Date: Tue, 23 Apr 2024 14:20:29 +0800 Subject: [PATCH 2/2] update --- src/processor/operator/aggregate/aggregate_hash_table.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/processor/operator/aggregate/aggregate_hash_table.cpp b/src/processor/operator/aggregate/aggregate_hash_table.cpp index 418ce77d6f..a0a45d4d81 100644 --- a/src/processor/operator/aggregate/aggregate_hash_table.cpp +++ b/src/processor/operator/aggregate/aggregate_hash_table.cpp @@ -1,7 +1,5 @@ #include "processor/operator/aggregate/aggregate_hash_table.h" -#include - #include "common/utils.h" using namespace kuzu::common;