| 501 | } |
| 502 | |
| 503 | void AggregateHashTable::findHashSlots(const std::vector<ValueVector*>& keyVectors, |
| 504 | const std::vector<ValueVector*>& dependentKeyVectors, const DataChunkState* leadingState) { |
| 505 | initTmpHashSlotsAndIdxes(); |
| 506 | auto numEntriesToFindHashSlots = leadingState->getSelSize(); |
| 507 | DASSERT(getNumEntries() + numEntriesToFindHashSlots < maxNumHashSlots); |
| 508 | while (numEntriesToFindHashSlots > 0) { |
| 509 | uint64_t numFTEntriesToUpdate = 0; |
| 510 | uint64_t numMayMatches = 0; |
| 511 | uint64_t numNoMatches = 0; |
| 512 | for (auto i = 0u; i < numEntriesToFindHashSlots; i++) { |
| 513 | auto idx = tmpValueIdxes[i]; |
| 514 | auto hash = hashVector->getValue<hash_t>(idx); |
| 515 | auto slot = hashSlotsToUpdateAggState[idx]; |
| 516 | if (slot->getEntry() == nullptr) { |
| 517 | entryIdxesToInitialize[numFTEntriesToUpdate++] = idx; |
| 518 | *slot = HashSlot(hash, factorizedTable->appendEmptyTuple()); |
| 519 | } else if (slot->checkFingerprint(hash)) { |
| 520 | mayMatchIdxes[numMayMatches++] = idx; |
| 521 | } else { |
| 522 | noMatchIdxes[numNoMatches++] = idx; |
| 523 | } |
| 524 | } |
| 525 | initializeFTEntries(keyVectors, dependentKeyVectors, numFTEntriesToUpdate); |
| 526 | numNoMatches = matchFTEntries(constSpan(keyVectors), numMayMatches, numNoMatches); |
| 527 | increaseHashSlotIdxes(numNoMatches); |
| 528 | DASSERT(numNoMatches <= numEntriesToFindHashSlots); |
| 529 | numEntriesToFindHashSlots = numNoMatches; |
| 530 | memcpy(tmpValueIdxes.get(), noMatchIdxes.get(), numNoMatches * sizeof(uint64_t)); |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | void AggregateHashTable::findHashSlots(const FactorizedTable& srcTable, uint64_t startOffset, |
| 535 | uint64_t numEntriesToFindHashSlots) { |
nothing calls this directly
no test coverage detected