| 1428 | |
| 1429 | template <bool ignoreNullKeys> |
| 1430 | void HashTable<ignoreNullKeys>::setHashMode(HashMode mode, int32_t numNew) { |
| 1431 | BOLT_CHECK_NE(hashMode_, HashMode::kHash); |
| 1432 | BOLT_TEST_ADJUST("bytedance::bolt::exec::HashTable::setHashMode", &mode); |
| 1433 | if (mode == HashMode::kArray) { |
| 1434 | const auto bytes = capacity_ * tableSlotSize(); |
| 1435 | const auto numPages = memory::AllocationTraits::numPages(bytes); |
| 1436 | rows_->pool()->allocateContiguous(numPages, tableAllocation_); |
| 1437 | table_ = tableAllocation_.data<char*>(); |
| 1438 | memset(table_, 0, bytes); |
| 1439 | hashMode_ = HashMode::kArray; |
| 1440 | rehash(true); |
| 1441 | } else if (mode == HashMode::kHash) { |
| 1442 | hashMode_ = HashMode::kHash; |
| 1443 | for (auto& hasher : hashers_) { |
| 1444 | hasher->resetStats(); |
| 1445 | } |
| 1446 | rows_->disableNormalizedKeys(); |
| 1447 | capacity_ = 0; |
| 1448 | // Makes tables of the right size and rehashes. |
| 1449 | checkSize(numNew, true); |
| 1450 | } else if (mode == HashMode::kNormalizedKey) { |
| 1451 | hashMode_ = HashMode::kNormalizedKey; |
| 1452 | capacity_ = 0; |
| 1453 | // Makes tables of the right size and rehashes. |
| 1454 | checkSize(numNew, true); |
| 1455 | } |
| 1456 | } |
| 1457 | |
| 1458 | template <bool ignoreNullKeys> |
| 1459 | bool HashTable<ignoreNullKeys>::analyze() { |
no test coverage detected