Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cpp/src/arrow/util/rle_encoding_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,15 @@ class BitPackedRunDecoder {
/// left.
[[nodiscard]] rle_size_t GetBatch(value_type* out, rle_size_t batch_size,
rle_size_t value_bit_width) {
const int bits_read = values_read_ * value_bit_width;
const int bytes_fully_read = bits_read / 8;
const int64_t bits_read = static_cast<int64_t>(values_read_) * value_bit_width;
const int64_t bytes_fully_read = bits_read / 8;
const uint8_t* unread_data = data_ + bytes_fully_read;

const ::arrow::internal::UnpackOptions opts{
/* .batch_size= */ std::min(batch_size, remaining()),
/* .bit_width= */ value_bit_width,
/* .bit_offset= */ bits_read % 8,
/* .max_read_bytes= */ max_read_bytes_ - bytes_fully_read,
/* .bit_offset= */ static_cast<int>(bits_read % 8),
/* .max_read_bytes= */ static_cast<int>(max_read_bytes_ - bytes_fully_read),
Comment on lines +381 to +382

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the same way that it may previously not fit in an int do we know that it will fit it at this point (and not turn negative)?

};

if constexpr (std::is_same_v<T, bool>) {
Expand Down
Loading