MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / findHashSlots

Method findHashSlots

src/processor/operator/aggregate/aggregate_hash_table.cpp:503–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

501}
502
503void 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
534void AggregateHashTable::findHashSlots(const FactorizedTable& srcTable, uint64_t startOffset,
535 uint64_t numEntriesToFindHashSlots) {

Callers

nothing calls this directly

Calls 7

getNumEntriesFunction · 0.85
HashSlotClass · 0.85
getSelSizeMethod · 0.80
appendEmptyTupleMethod · 0.80
checkFingerprintMethod · 0.80
getEntryMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected