Skip to content

Commit 33204e1

Browse files
authored
chore: avoid copy when building chunk_offsets in chunked layout reader (#5006)
Signed-off-by: Robert Kruszewski <[email protected]>
1 parent 4a44d84 commit 33204e1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

vortex-layout/src/layouts/chunked/reader.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ impl ChunkedReader {
3838
) -> Self {
3939
let nchildren = layout.nchildren();
4040

41-
let mut chunk_offsets = vec![0; nchildren];
41+
let mut chunk_offsets = vec![0; nchildren + 1];
4242
for i in 1..nchildren {
4343
chunk_offsets[i] = chunk_offsets[i - 1] + layout.children.child_row_count(i - 1);
4444
}
45-
chunk_offsets.push(layout.row_count());
46-
debug_assert_eq!(chunk_offsets.len(), nchildren + 1);
45+
chunk_offsets[nchildren] = layout.row_count();
4746

4847
let lazy_children = LazyReaderChildren::new(layout.children.clone(), segment_source);
4948

0 commit comments

Comments
 (0)