Skip to content

Commit 4f2fff4

Browse files
committed
Add suggested assertion and a comment
1 parent 13e5cc2 commit 4f2fff4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cpp/src/arrow/compute/kernels/chunked_internal.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ ChunkedIndexMapper::LogicalToPhysical() {
6767
}
6868

6969
const int64_t num_indices = static_cast<int64_t>(indices_end_ - indices_begin_);
70+
DCHECK_EQ(num_indices, std::accumulate(chunk_lengths_.begin(), chunk_lengths_.end(),
71+
static_cast<int64_t>(0)));
7072
CompressedChunkLocation* physical_begin =
7173
reinterpret_cast<CompressedChunkLocation*>(indices_begin_);
7274
DCHECK_EQ(physical_begin + num_indices,
@@ -77,6 +79,8 @@ ChunkedIndexMapper::LogicalToPhysical() {
7779
++chunk_index) {
7880
const int64_t chunk_length = chunk_lengths_[chunk_index];
7981
for (int64_t i = 0; i < chunk_length; ++i) {
82+
// Logical indices are expected to be chunk-partitioned, which avoids costly
83+
// chunked index resolution.
8084
DCHECK_GE(indices_begin_[chunk_offset + i], static_cast<uint64_t>(chunk_offset));
8185
DCHECK_LT(indices_begin_[chunk_offset + i],
8286
static_cast<uint64_t>(chunk_offset + chunk_length));

0 commit comments

Comments
 (0)