Skip to content

Commit

Permalink
Update parquet/src/arrow/array_reader/byte_view_array.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Raphael Taylor-Davies <[email protected]>
  • Loading branch information
XiangpengHao and tustvold authored Jan 6, 2025
1 parent 88e1a6a commit bc838a4
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions parquet/src/arrow/array_reader/byte_view_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,20 +318,14 @@ impl ByteViewArrayDecoderPlain {
pub fn read(&mut self, output: &mut ViewBuffer, len: usize) -> Result<usize> {
// avoid creating a new buffer if the last buffer is the same as the current buffer
// This is especially useful when row-level filtering is applied, where we call lots of small `read` over the same buffer.
let need_to_create_new_buffer = {
if let Some(last_buffer) = output.buffers.last() {
!last_buffer.ptr_eq(&self.buf)
let block_id = {
if output.buffers.last().is_some_and(|x| x.ptr_eq(&self.buf)) {
output.buffers.len() as u32 - 1
} else {
true
output.append_block(self.buf.clone())
}
};

let block_id = if need_to_create_new_buffer {
output.append_block(self.buf.clone())
} else {
output.buffers.len() as u32 - 1
};

let to_read = len.min(self.max_remaining_values);

let buf = self.buf.as_ref();
Expand Down

0 comments on commit bc838a4

Please sign in to comment.