MCPcopy Create free account
hub / github.com/bytedance/bolt / testProbe

Method testProbe

bolt/exec/tests/HashTableTest.cpp:481–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479 }
480
481 void testProbe() {
482 auto lookup = std::make_unique<HashLookup>(
483 topTable_->hashers(), GetParam().jitRowEqVectors);
484 const auto batchSize = batches_[0]->size();
485 SelectivityVector rows(batchSize);
486 const auto mode = topTable_->hashMode();
487 SelectivityInfo hashTime;
488 SelectivityInfo probeTime;
489 int32_t numHashed = 0;
490 int32_t numProbed = 0;
491 int32_t numHit = 0;
492 auto& hashers = topTable_->hashers();
493 VectorHasher::ScratchMemory scratchMemory;
494 for (auto batchIndex = 0; batchIndex < batches_.size(); ++batchIndex) {
495 const auto& batch = batches_[batchIndex];
496 lookup->reset(batch->size());
497 rows.setAll();
498 numHashed += batch->size();
499 {
500 SelectivityTimer timer(hashTime, 0);
501 for (auto i = 0; i < hashers.size(); ++i) {
502 auto& key = batch->childAt(i);
503 if (mode != BaseHashTable::HashMode::kHash) {
504 hashers[i]->lookupValueIds(
505 *key, rows, scratchMemory, lookup->hashes);
506 } else {
507 hashers[i]->decode(*key, rows);
508 hashers[i]->hash(rows, i > 0, lookup->hashes);
509 }
510 }
511 }
512
513 lookup->rows.clear();
514 if (rows.isAllSelected()) {
515 lookup->rows.resize(rows.size());
516 std::iota(lookup->rows.begin(), lookup->rows.end(), 0);
517 } else {
518 constexpr int32_t kPadding = simd::kPadding / sizeof(int32_t);
519 lookup->rows.resize(bits::roundUp(rows.size() + kPadding, kPadding));
520 const auto numRows = simd::indicesOfSetBits(
521 rows.asRange().bits(), 0, batch->size(), lookup->rows.data());
522 lookup->rows.resize(numRows);
523 }
524
525 const auto startOffset = batchIndex * batchSize;
526 if (lookup->rows.empty()) {
527 // the keys disqualify all entries. The table is not consulted.
528 for (auto i = startOffset; i < startOffset + batch->size(); ++i) {
529 ASSERT_EQ(nullptr, rowOfKey_[i]);
530 }
531 } else {
532 {
533 numProbed += lookup->rows.size();
534 SelectivityTimer timer(probeTime, 0);
535 topTable_->joinProbe(*lookup);
536 }
537 for (auto i = 0; i < lookup->rows.size(); ++i) {
538 const auto key = lookup->rows[i];

Callers

nothing calls this directly

Calls 15

roundUpFunction · 0.85
indicesOfSetBitsFunction · 0.85
hashModeMethod · 0.80
setAllMethod · 0.80
childAtMethod · 0.80
lookupValueIdsMethod · 0.80
isAllSelectedMethod · 0.80
joinProbeMethod · 0.80
iotaFunction · 0.50
sizeMethod · 0.45
resetMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected