Skip to content

Commit 8cb79d9

Browse files
authored
All-invalid compressor (#6330)
Signed-off-by: Nicholas Gates <nick@nickgates.com>
1 parent 71ffc98 commit 8cb79d9

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • vortex-btrblocks/src/compressor

vortex-btrblocks/src/compressor/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
//! Compressor traits for type-specific compression.
55
66
use vortex_array::ArrayRef;
7+
use vortex_array::IntoArray;
8+
use vortex_array::arrays::ConstantArray;
79
use vortex_array::vtable::VTable;
810
use vortex_error::VortexResult;
11+
use vortex_scalar::Scalar;
912

1013
use crate::BtrBlocksCompressor;
1114
use 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)?;

0 commit comments

Comments
 (0)