Skip to content

Commit

Permalink
feat(cpp/computer): apache#38074 Support uint64_t types in slice func…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
llama90 committed Oct 9, 2023
1 parent e038498 commit e546f17
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cpp/src/arrow/compute/light_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,24 @@ KeyColumnArray KeyColumnArray::Slice(int64_t offset, int64_t length) const {
KeyColumnArray sliced;
sliced.metadata_ = metadata_;
sliced.length_ = length;
uint32_t fixed_size =
!metadata_.is_fixed_length ? sizeof(uint32_t) : metadata_.fixed_length;

sliced.buffers_[0] =
buffers_[0] ? buffers_[0] + (bit_offset_[0] + offset) / 8 : nullptr;
sliced.mutable_buffers_[0] =
mutable_buffers_[0] ? mutable_buffers_[0] + (bit_offset_[0] + offset) / 8 : nullptr;
sliced.bit_offset_[0] = (bit_offset_[0] + offset) % 8;

if (fixed_size == 0 && !metadata_.is_null_type) {
if (metadata_.fixed_length == 0 && !metadata_.is_null_type) {
sliced.buffers_[1] =
buffers_[1] ? buffers_[1] + (bit_offset_[1] + offset) / 8 : nullptr;
sliced.mutable_buffers_[1] = mutable_buffers_[1]
? mutable_buffers_[1] + (bit_offset_[1] + offset) / 8
: nullptr;
sliced.bit_offset_[1] = (bit_offset_[1] + offset) % 8;
} else {
sliced.buffers_[1] = buffers_[1] ? buffers_[1] + offset * fixed_size : nullptr;
sliced.buffers_[1] = buffers_[1] ? buffers_[1] + offset * metadata_.fixed_length : nullptr;
sliced.mutable_buffers_[1] =
mutable_buffers_[1] ? mutable_buffers_[1] + offset * fixed_size : nullptr;
mutable_buffers_[1] ? mutable_buffers_[1] + offset * metadata_.fixed_length : nullptr;
sliced.bit_offset_[1] = 0;
}

Expand Down

0 comments on commit e546f17

Please sign in to comment.