Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zanmato1984 committed Dec 27, 2024
1 parent bcc43da commit e313ee6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
9 changes: 2 additions & 7 deletions cpp/src/arrow/compute/key_map_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,6 @@ uint64_t SwissTable::num_groups_for_resize() const {
}
}

uint32_t SwissTable::wrap_global_slot_id(uint32_t global_slot_id) const {
uint32_t global_slot_id_mask = static_cast<uint32_t>((1ULL << (log_blocks_ + 3)) - 1);
return global_slot_id & global_slot_id_mask;
}

void SwissTable::early_filter(const int num_keys, const uint32_t* hashes,
uint8_t* out_match_bitvector,
uint8_t* out_local_slots) const {
Expand Down Expand Up @@ -362,7 +357,7 @@ bool SwissTable::find_next_stamp_match(const uint32_t hash, const uint32_t in_sl
constexpr uint64_t stamp_mask = 0x7f;
const int stamp =
static_cast<int>((hash >> bits_shift_for_block_and_stamp_) & stamp_mask);
uint32_t start_slot_id = wrap_global_slot_id(in_slot_id);
uint32_t start_slot_id = in_slot_id;
int match_found;
int local_slot;
uint8_t* blockbase;
Expand All @@ -372,7 +367,7 @@ bool SwissTable::find_next_stamp_match(const uint32_t hash, const uint32_t in_sl

search_block<true>(block, stamp, start_slot_id & 7, &local_slot, &match_found);

start_slot_id = wrap_global_slot_id(start_slot_id & ~7U + local_slot + match_found);
start_slot_id = (start_slot_id & ~7U) + local_slot + match_found;

// Match found can be 1 in two cases:
// - match was found
Expand Down
20 changes: 0 additions & 20 deletions cpp/src/arrow/compute/key_map_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ class ARROW_EXPORT SwissTable {

inline uint64_t num_groups_for_resize() const;

inline uint32_t wrap_global_slot_id(uint32_t global_slot_id) const;

void init_slot_ids(const int num_keys, const uint16_t* selection,
const uint32_t* hashes, const uint8_t* local_slots,
const uint8_t* match_bitvector, uint32_t* out_slot_ids) const;
Expand Down Expand Up @@ -266,24 +264,6 @@ class ARROW_EXPORT SwissTable {
MemoryPool* pool_;
};

// uint32_t SwissTable::extract_group_id(const uint8_t* block_ptr, int slot,
// uint64_t group_id_mask) const {
// // Group id values for all 8 slots in the block are bit-packed and follow the status
// // bytes. We assume here that the number of bits is rounded up to 8, 16, 32 or 64. In
// // that case we can extract group id using aligned 64-bit word access.
// int num_group_id_bits = static_cast<int>(ARROW_POPCOUNT64(group_id_mask));
// assert(num_group_id_bits == 8 || num_group_id_bits == 16 || num_group_id_bits == 32
// ||
// num_group_id_bits == 64);

// int bit_offset = slot * num_group_id_bits;
// const uint64_t* group_id_bytes =
// reinterpret_cast<const uint64_t*>(block_ptr) + 1 + (bit_offset >> 6);
// uint64_t group_id = (*group_id_bytes >> (bit_offset & 63)) & group_id_mask;

// return group_id;
// }

void SwissTable::insert_into_empty_slot(uint32_t slot_id, uint32_t hash,
uint32_t group_id) {
const int64_t num_groupid_bits = num_groupid_bits_from_log_blocks(log_blocks_);
Expand Down

0 comments on commit e313ee6

Please sign in to comment.