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

Method setHashMode

bolt/exec/HashTable.cpp:1430–1456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1428
1429template <bool ignoreNullKeys>
1430void 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
1458template <bool ignoreNullKeys>
1459bool HashTable<ignoreNullKeys>::analyze() {

Callers 1

prepareJoinTableMethod · 0.45

Calls 5

memsetFunction · 0.85
resetStatsMethod · 0.80
disableNormalizedKeysMethod · 0.80
allocateContiguousMethod · 0.45
poolMethod · 0.45

Tested by

no test coverage detected