| 427 | std::vector<RowVectorPtr>& batches) { |
| 428 | for (auto i = 0; i < numBatches; ++i) { |
| 429 | batches.push_back(std::static_pointer_cast<RowVector>( |
| 430 | makeVector(buildType, batchSize, sequence))); |
| 431 | sequence += batchSize; |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | void testProbe() { |
| 436 | auto lookup = std::make_unique<HashLookup>(topTable_->hashers()); |
| 437 | auto batchSize = batches_[0]->size(); |
| 438 | SelectivityVector rows(batchSize); |
| 439 | auto mode = topTable_->hashMode(); |
| 440 | SelectivityInfo hashTime; |
| 441 | SelectivityInfo probeTime; |
| 442 | int32_t numHashed = 0; |
| 443 | int32_t numProbed = 0; |
| 444 | int32_t numHit = 0; |
| 445 | auto& hashers = topTable_->hashers(); |
| 446 | VectorHasher::ScratchMemory scratchMemory; |
| 447 | for (auto batchIndex = 0; batchIndex < batches_.size(); ++batchIndex) { |
| 448 | auto batch = batches_[batchIndex]; |
| 449 | lookup->reset(batch->size()); |
| 450 | rows.setAll(); |
| 451 | numHashed += batch->size(); |
| 452 | { |
| 453 | SelectivityTimer timer(hashTime, 0); |
| 454 | for (auto i = 0; i < hashers.size(); ++i) { |
| 455 | auto key = batch->childAt(i); |
| 456 | if (mode != BaseHashTable::HashMode::kHash) { |
| 457 | hashers[i]->lookupValueIds( |
| 458 | *key, rows, scratchMemory, lookup->hashes); |
| 459 | } else { |
| 460 | hashers[i]->decode(*key, rows); |
| 461 | hashers[i]->hash(rows, i > 0, lookup->hashes); |
| 462 | } |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | lookup->rows.clear(); |
| 467 | if (rows.isAllSelected()) { |
| 468 | lookup->rows.resize(rows.size()); |
| 469 | std::iota(lookup->rows.begin(), lookup->rows.end(), 0); |
| 470 | } else { |
| 471 | constexpr int32_t kPadding = simd::kPadding / sizeof(int32_t); |
| 472 | lookup->rows.resize(bits::roundUp(rows.size() + kPadding, kPadding)); |
| 473 | auto numRows = simd::indicesOfSetBits( |
| 474 | rows.asRange().bits(), 0, batch->size(), lookup->rows.data()); |
| 475 | lookup->rows.resize(numRows); |
| 476 | } |
| 477 | auto startOffset = batchIndex * batchSize; |
| 478 | if (lookup->rows.empty()) { |
| 479 | // the keys disqualify all entries. The table is not consulted. |
| 480 | for (auto i = startOffset; i < startOffset + batch->size(); ++i) { |
| 481 | ASSERT_EQ(nullptr, rowOfKey_[i]); |
| 482 | } |
| 483 | } else { |
| 484 | { |
| 485 | numProbed += lookup->rows.size(); |
| 486 | SelectivityTimer timer(probeTime, 0); |
nothing calls this directly
no test coverage detected