MCPcopy Create free account
hub / github.com/apache/arrow / init

Method init

cpp/src/arrow/compute/key_map_internal.cc:773–808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

771}
772
773Status SwissTable::init(int64_t hardware_flags, MemoryPool* pool, int log_blocks,
774 bool no_hash_array) {
775 hardware_flags_ = hardware_flags;
776 pool_ = pool;
777 log_minibatch_ = util::MiniBatch::kLogMiniBatchLength;
778
779 log_blocks_ = log_blocks;
780 bits_shift_for_block_and_stamp_ = ComputeBitsShiftForBlockAndStamp(log_blocks_);
781 bits_shift_for_block_ = ComputeBitsShiftForBlock(log_blocks_);
782 int num_groupid_bits = num_groupid_bits_from_log_blocks(log_blocks_);
783 num_inserted_ = 0;
784
785 const int block_bytes = num_block_bytes_from_num_groupid_bits(num_groupid_bits);
786 const int64_t slot_bytes = num_bytes_total_blocks(block_bytes, log_blocks_);
787 ARROW_ASSIGN_OR_RAISE(blocks_, AllocateBuffer(slot_bytes, pool_));
788
789 // Make sure group ids are initially set to zero for all slots.
790 memset(blocks_->mutable_data(), 0, slot_bytes);
791
792 // Initialize all status bytes to represent an empty slot.
793 for (int i = 0; i < 1 << log_blocks_; ++i) {
794 auto block = mutable_block_data(i, block_bytes);
795 util::SafeStore(block, kHighBitOfEachByte);
796 }
797
798 if (no_hash_array) {
799 hashes_ = nullptr;
800 } else {
801 int64_t num_slots = num_slots_from_log_blocks(log_blocks);
802 const int hash_size = bits_hash_ >> 3;
803 const int64_t hash_bytes = hash_size * num_slots + padding_;
804 ARROW_ASSIGN_OR_RAISE(hashes_, AllocateBuffer(hash_bytes, pool_));
805 }
806
807 return Status::OK();
808}
809
810void SwissTable::cleanup() {
811 if (blocks_) {

Callers 15

PrepareForMergeMethod · 0.45
InitMethod · 0.45
BindNonRecursiveFunction · 0.45
TESTFunction · 0.45
InitAllMethod · 0.45
KernelInitMethod · 0.45
BM_CastDispatchBaselineFunction · 0.45
AddFirstOrLastAggKernelFunction · 0.45
AddMinOrMaxAggKernelFunction · 0.45
MakeMinOrMaxKernelFunction · 0.45
MakeFirstOrLastKernelFunction · 0.45

Calls 11

ComputeBitsShiftForBlockFunction · 0.85
num_bytes_total_blocksFunction · 0.85
mutable_block_dataFunction · 0.85
ARROW_ASSIGN_OR_RAISEFunction · 0.50
AllocateBufferFunction · 0.50
OKFunction · 0.50
mutable_dataMethod · 0.45

Tested by 1

TESTFunction · 0.36