Skip to content

Commit b6af58d

Browse files
committed
fixup! address comments from viirya
1 parent 5991cc7 commit b6af58d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

parquet-variant/src/builder.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ fn write_offset(buf: &mut Vec<u8>, value: usize, nbytes: u8) {
6464
}
6565

6666
/// Write little-endian integer to buffer at a specific position
67-
fn write_offset_at_pos(buf: &mut [u8], index: usize, value: usize, nbytes: u8) {
67+
fn write_offset_at_pos(buf: &mut [u8], start_pos: usize, value: usize, nbytes: u8) {
6868
let bytes = value.to_le_bytes();
69-
buf[index..index + nbytes as usize].copy_from_slice(&bytes[..nbytes as usize]);
69+
buf[start_pos..start_pos + nbytes as usize].copy_from_slice(&bytes[..nbytes as usize]);
7070
}
7171

7272
/// Wrapper around a `Vec<u8>` that provides methods for appending
@@ -383,15 +383,14 @@ impl ValueBuffer {
383383
/// from the starting position of the buffer, will return the position after this write
384384
fn append_offset_array_start_from_buf_pos(
385385
&mut self,
386-
start_index: usize,
386+
start_pos: usize,
387387
offsets: impl IntoIterator<Item = usize>,
388388
data_size: Option<usize>,
389389
nbytes: u8,
390390
) -> usize {
391391
let buf = self.inner_mut();
392392

393-
// Write field offsets (adjusted for header)
394-
let mut current_pos = start_index; // skip the header byte
393+
let mut current_pos = start_pos;
395394
for relative_offset in offsets {
396395
write_offset_at_pos(buf, current_pos, relative_offset, nbytes);
397396
current_pos += nbytes as usize;

0 commit comments

Comments
 (0)