@@ -71,7 +71,6 @@ struct ByteViewArrayReader {
71
71
}
72
72
73
73
impl ByteViewArrayReader {
74
- #[ allow( unused) ]
75
74
fn new (
76
75
pages : Box < dyn PageIterator > ,
77
76
data_type : ArrowType ,
@@ -316,7 +315,10 @@ impl ByteViewArrayDecoderPlain {
316
315
}
317
316
318
317
pub fn read ( & mut self , output : & mut ViewBuffer , len : usize ) -> Result < usize > {
319
- let block_id = output. append_block ( self . buf . clone ( ) . into ( ) ) ;
318
+ // Here we convert `bytes::Bytes` into `arrow_buffer::Bytes`, which is zero copy
319
+ // Then we convert `arrow_buffer::Bytes` into `arrow_buffer:Buffer`, which is also zero copy
320
+ let buf = arrow_buffer:: Buffer :: from_bytes ( self . buf . clone ( ) . into ( ) ) ;
321
+ let block_id = output. append_block ( buf) ;
320
322
321
323
let to_read = len. min ( self . max_remaining_values ) ;
322
324
@@ -546,7 +548,10 @@ impl ByteViewArrayDecoderDeltaLength {
546
548
547
549
let src_lengths = & self . lengths [ self . length_offset ..self . length_offset + to_read] ;
548
550
549
- let block_id = output. append_block ( self . data . clone ( ) . into ( ) ) ;
551
+ // Here we convert `bytes::Bytes` into `arrow_buffer::Bytes`, which is zero copy
552
+ // Then we convert `arrow_buffer::Bytes` into `arrow_buffer:Buffer`, which is also zero copy
553
+ let bytes = arrow_buffer:: Buffer :: from_bytes ( self . data . clone ( ) . into ( ) ) ;
554
+ let block_id = output. append_block ( bytes) ;
550
555
551
556
let mut current_offset = self . data_offset ;
552
557
let initial_offset = current_offset;
0 commit comments