File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
vortex-array/src/arrays/varbinview Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -33,17 +33,24 @@ impl VarBinViewArray {
3333 }
3434
3535 fn should_compact ( & self ) -> bool {
36+ let nbuffers = self . nbuffers ( ) ;
37+
3638 // If the array is entirely inlined strings, do not attempt to compact.
37- if self . nbuffers ( ) == 0 {
39+ if nbuffers == 0 {
3840 return false ;
3941 }
4042
43+ // These will fail to write, so in most cases we want to compact this.
44+ if nbuffers > u16:: MAX as usize {
45+ return true ;
46+ }
47+
4148 let bytes_referenced: u64 = self . count_referenced_bytes ( ) ;
4249 let buffer_total_bytes: u64 = self . buffers . iter ( ) . map ( |buf| buf. len ( ) as u64 ) . sum ( ) ;
4350
4451 // If there is any wasted space, we want to repack.
4552 // This is very aggressive.
46- bytes_referenced < buffer_total_bytes
53+ bytes_referenced < buffer_total_bytes || buffer_total_bytes == 0
4754 }
4855
4956 // count the number of bytes addressed by the views, not including null
You can’t perform that action at this time.
0 commit comments