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

Method init

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

Source from the content-addressed store, hash-verified

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

Callers 14

PrepareForMergeMethod · 0.45
InitMethod · 0.45
BindNonRecursiveFunction · 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 12

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

Tested by

no test coverage detected