Skip to content
Closed
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions vortex-compressor/src/builtins/dict/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ impl Scheme for FloatDictScheme {
) -> VortexResult<ArrayRef> {
// TODO(connor): Fight the borrow checker (needs interior mutability)!
let stats = data.float_stats().clone();

// If there are no non-null values (e.g., an all-null sample), there are no distinct
// values to dictionary-encode. Return the array unchanged.
if stats.value_count() == 0 {
return Ok(data.array().clone());
}

let dict = dictionary_encode(data.array_as_primitive(), &stats)?;

let has_all_values_referenced = dict.has_all_values_referenced();
Expand Down
7 changes: 7 additions & 0 deletions vortex-compressor/src/builtins/dict/integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ impl Scheme for IntDictScheme {
) -> VortexResult<ArrayRef> {
// TODO(connor): Fight the borrow checker (needs interior mutability)!
let stats = data.integer_stats().clone();

// If there are no non-null values (e.g., an all-null sample), there are no distinct
// values to dictionary-encode. Return the array unchanged.
if stats.value_count() == 0 {
return Ok(data.array().clone());
}

let dict = dictionary_encode(data.array_as_primitive(), &stats)?;

// Values = child 0.
Expand Down
Loading