Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions vortex-btrblocks/src/compressor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
//! Compressor traits for type-specific compression.

use vortex_array::ArrayRef;
use vortex_array::IntoArray;
use vortex_array::arrays::ConstantArray;
use vortex_array::vtable::VTable;
use vortex_error::VortexResult;
use vortex_scalar::Scalar;

use crate::BtrBlocksCompressor;
use crate::CompressorContext;
Expand Down Expand Up @@ -138,6 +141,13 @@ where
return Ok(array.to_array());
}

// Avoid compressing all-null arrays.
if array.all_invalid()? {
return Ok(
ConstantArray::new(Scalar::null(array.dtype().clone()), array.len()).into_array(),
);
}

// Generate stats on the array directly.
let stats = self.gen_stats(array);
let best_scheme = self.choose_scheme(btr_blocks_compressor, &stats, ctx, excludes)?;
Expand Down
Loading