File tree Expand file tree Collapse file tree
vortex-btrblocks/src/compressor Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44//! Compressor traits for type-specific compression.
55
66use vortex_array:: ArrayRef ;
7+ use vortex_array:: IntoArray ;
8+ use vortex_array:: arrays:: ConstantArray ;
79use vortex_array:: vtable:: VTable ;
810use vortex_error:: VortexResult ;
11+ use vortex_scalar:: Scalar ;
912
1013use crate :: BtrBlocksCompressor ;
1114use crate :: CompressorContext ;
@@ -138,6 +141,13 @@ where
138141 return Ok ( array. to_array ( ) ) ;
139142 }
140143
144+ // Avoid compressing all-null arrays.
145+ if array. all_invalid ( ) ? {
146+ return Ok (
147+ ConstantArray :: new ( Scalar :: null ( array. dtype ( ) . clone ( ) ) , array. len ( ) ) . into_array ( ) ,
148+ ) ;
149+ }
150+
141151 // Generate stats on the array directly.
142152 let stats = self . gen_stats ( array) ;
143153 let best_scheme = self . choose_scheme ( btr_blocks_compressor, & stats, ctx, excludes) ?;
You can’t perform that action at this time.
0 commit comments