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

Function findPartition

bolt/exec/HashTable.cpp:1117–1133  ·  view source on GitHub ↗

Returns an index into 'buildPartitionBounds_' given an index into tags of the HashTable.

Source from the content-addressed store, hash-verified

1115// Returns an index into 'buildPartitionBounds_' given an index into tags of the
1116// HashTable.
1117int32_t findPartition(
1118 PartitionBoundIndexType index,
1119 const PartitionBoundIndexType* bounds,
1120 int32_t numPartitions) {
1121 // The partition bounds are padded to batch size.
1122 constexpr int32_t kBatch = xsimd::batch<PartitionBoundIndexType>::size;
1123 auto indexVector = xsimd::batch<PartitionBoundIndexType>::broadcast(index);
1124 for (auto i = 1; i < numPartitions; i += kBatch) {
1125 auto bits = simd::toBitMask(
1126 indexVector <
1127 xsimd::batch<PartitionBoundIndexType>::load_unaligned(bounds + i));
1128 if (bits) {
1129 return i + __builtin_ctz(bits) - 1;
1130 }
1131 }
1132 BOLT_UNREACHABLE("Partition index out of range");
1133}
1134} // namespace
1135
1136template <bool ignoreNullKeys>

Callers 1

partitionRowsMethod · 0.85

Calls 1

toBitMaskFunction · 0.85

Tested by

no test coverage detected