Skip to content

Commit

Permalink
Add suggested assertion and a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pitrou committed Nov 26, 2024
1 parent 13e5cc2 commit 4f2fff4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cpp/src/arrow/compute/kernels/chunked_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ ChunkedIndexMapper::LogicalToPhysical() {
}

const int64_t num_indices = static_cast<int64_t>(indices_end_ - indices_begin_);
DCHECK_EQ(num_indices, std::accumulate(chunk_lengths_.begin(), chunk_lengths_.end(),
static_cast<int64_t>(0)));
CompressedChunkLocation* physical_begin =
reinterpret_cast<CompressedChunkLocation*>(indices_begin_);
DCHECK_EQ(physical_begin + num_indices,
Expand All @@ -77,6 +79,8 @@ ChunkedIndexMapper::LogicalToPhysical() {
++chunk_index) {
const int64_t chunk_length = chunk_lengths_[chunk_index];
for (int64_t i = 0; i < chunk_length; ++i) {
// Logical indices are expected to be chunk-partitioned, which avoids costly
// chunked index resolution.
DCHECK_GE(indices_begin_[chunk_offset + i], static_cast<uint64_t>(chunk_offset));
DCHECK_LT(indices_begin_[chunk_offset + i],
static_cast<uint64_t>(chunk_offset + chunk_length));
Expand Down

0 comments on commit 4f2fff4

Please sign in to comment.