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

Method hashRows

bolt/exec/HashTable.cpp:916–957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

914
915template <bool ignoreNullKeys>
916bool HashTable<ignoreNullKeys>::hashRows(
917 folly::Range<char**> rows,
918 bool initNormalizedKeys,
919 raw_vector<uint64_t>& hashes) {
920 if (rows.empty()) {
921 return true;
922 }
923 if (!initNormalizedKeys && hashMode_ == HashMode::kNormalizedKey) {
924 for (auto i = 0; i < rows.size(); ++i) {
925 hashes[i] =
926 mixNormalizedKey(RowContainer::normalizedKey(rows[i]), sizeBits_);
927 }
928 return true;
929 }
930
931 for (int32_t i = 0; i < hashers_.size(); ++i) {
932 auto& hasher = hashers_[i];
933 if (hashMode_ == HashMode::kHash) {
934 rows_->hash(i, rows, i > 0, hashes.data());
935 } else {
936 // Array or normalized key.
937 auto column = rows_->columnAt(i);
938 if (!hasher->computeValueIdsForRows(
939 rows.data(),
940 rows.size(),
941 column.offset(),
942 column.nullByte(),
943 ignoreNullKeys ? 0 : column.nullMask(),
944 hashes)) {
945 // Must reconsider 'hashMode_' and start over.
946 return false;
947 }
948 }
949 }
950 if (hashMode_ == HashMode::kNormalizedKey && initNormalizedKeys) {
951 for (auto i = 0; i < rows.size(); ++i) {
952 RowContainer::normalizedKey(rows[i]) = hashes[i];
953 hashes[i] = mixNormalizedKey(hashes[i], sizeBits_);
954 }
955 }
956 return true;
957}
958
959namespace {
960template <typename Source>

Callers

nothing calls this directly

Calls 10

mixNormalizedKeyFunction · 0.85
columnAtMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
hashMethod · 0.45
dataMethod · 0.45
offsetMethod · 0.45
nullByteMethod · 0.45
nullMaskMethod · 0.45

Tested by

no test coverage detected