File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -162,11 +162,12 @@ impl ColumnValueDecoder for ByteViewArrayColumnValueDecoder {
162162 ) ) ;
163163 }
164164
165- let mut buffer = ViewBuffer :: default ( ) ;
165+ let num_values = num_values as usize ;
166+ let mut buffer = ViewBuffer :: with_capacity ( num_values) ;
166167 let mut decoder = ByteViewArrayDecoderPlain :: new (
167168 buf,
168- num_values as usize ,
169- Some ( num_values as usize ) ,
169+ num_values,
170+ Some ( num_values) ,
170171 self . validate_utf8 ,
171172 ) ;
172173 decoder. read ( & mut buffer, usize:: MAX ) ?;
Original file line number Diff line number Diff line change @@ -33,6 +33,14 @@ pub struct ViewBuffer {
3333}
3434
3535impl ViewBuffer {
36+ /// Create a new ViewBuffer with capacity for the specified number of views
37+ pub fn with_capacity ( capacity : usize ) -> Self {
38+ Self {
39+ views : Vec :: with_capacity ( capacity) ,
40+ buffers : Vec :: new ( ) ,
41+ }
42+ }
43+
3644 pub fn is_empty ( & self ) -> bool {
3745 self . views . is_empty ( )
3846 }
You can’t perform that action at this time.
0 commit comments