| 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]; |
nothing calls this directly
no test coverage detected