| 1398 | |
| 1399 | template <bool ignoreNullKeys> |
| 1400 | void HashTable<ignoreNullKeys>::rehash(bool initNormalizedKeys) { |
| 1401 | ++numRehashes_; |
| 1402 | constexpr int32_t kHashBatchSize = 1024; |
| 1403 | if (canApplyParallelJoinBuild()) { |
| 1404 | parallelJoinBuild(); |
| 1405 | return; |
| 1406 | } |
| 1407 | raw_vector<uint64_t> hashes; |
| 1408 | hashes.resize(kHashBatchSize); |
| 1409 | char* groups[kHashBatchSize]; |
| 1410 | // A join build can have multiple payload tables. Loop over 'this' |
| 1411 | // and the possible other tables and put all the data in the table |
| 1412 | // of 'this'. |
| 1413 | for (int32_t i = 0; i <= otherTables_.size(); ++i) { |
| 1414 | RowContainerIterator iterator; |
| 1415 | int32_t numGroups; |
| 1416 | auto rowContainer = (i == 0 ? this : otherTables_[i - 1].get())->rows(); |
| 1417 | do { |
| 1418 | numGroups = rowContainer->listRows(&iterator, kHashBatchSize, groups); |
| 1419 | if (!insertBatch( |
| 1420 | groups, numGroups, hashes, initNormalizedKeys || i != 0)) { |
| 1421 | BOLT_CHECK_NE(hashMode_, HashMode::kHash); |
| 1422 | setHashMode(HashMode::kHash, 0); |
| 1423 | return; |
| 1424 | } |
| 1425 | } while (numGroups > 0); |
| 1426 | } |
| 1427 | } |
| 1428 | |
| 1429 | template <bool ignoreNullKeys> |
| 1430 | void HashTable<ignoreNullKeys>::setHashMode(HashMode mode, int32_t numNew) { |