diff --git a/parquet/src/arrow/array_reader/byte_view_array.rs b/parquet/src/arrow/array_reader/byte_view_array.rs index dc4ce3f9c1bd..d1a0313dc1e8 100644 --- a/parquet/src/arrow/array_reader/byte_view_array.rs +++ b/parquet/src/arrow/array_reader/byte_view_array.rs @@ -71,7 +71,6 @@ struct ByteViewArrayReader { } impl ByteViewArrayReader { - #[allow(unused)] fn new( pages: Box, data_type: ArrowType, @@ -316,7 +315,10 @@ impl ByteViewArrayDecoderPlain { } pub fn read(&mut self, output: &mut ViewBuffer, len: usize) -> Result { - let block_id = output.append_block(self.buf.clone().into()); + // Here we convert `bytes::Bytes` into `arrow_buffer::Bytes`, which is zero copy + // Then we convert `arrow_buffer::Bytes` into `arrow_buffer:Buffer`, which is also zero copy + let buf = arrow_buffer::Buffer::from_bytes(self.buf.clone().into()); + let block_id = output.append_block(buf); let to_read = len.min(self.max_remaining_values); @@ -546,7 +548,10 @@ impl ByteViewArrayDecoderDeltaLength { let src_lengths = &self.lengths[self.length_offset..self.length_offset + to_read]; - let block_id = output.append_block(self.data.clone().into()); + // Here we convert `bytes::Bytes` into `arrow_buffer::Bytes`, which is zero copy + // Then we convert `arrow_buffer::Bytes` into `arrow_buffer:Buffer`, which is also zero copy + let bytes = arrow_buffer::Buffer::from_bytes(self.data.clone().into()); + let block_id = output.append_block(bytes); let mut current_offset = self.data_offset; let initial_offset = current_offset; diff --git a/parquet/src/arrow/buffer/view_buffer.rs b/parquet/src/arrow/buffer/view_buffer.rs index ae83ac317771..2256f4877d68 100644 --- a/parquet/src/arrow/buffer/view_buffer.rs +++ b/parquet/src/arrow/buffer/view_buffer.rs @@ -68,7 +68,6 @@ impl ViewBuffer { } /// Converts this into an [`ArrayRef`] with the provided `data_type` and `null_buffer` - #[allow(unused)] pub fn into_array(self, null_buffer: Option, data_type: &ArrowType) -> ArrayRef { let len = self.views.len(); let views = Buffer::from_vec(self.views);