From d5005eb788ca8415b3cb48dd656d096b42e4f24a Mon Sep 17 00:00:00 2001 From: Joe Isaacs Date: Wed, 8 Apr 2026 15:58:26 +0100 Subject: [PATCH] fix Signed-off-by: Joe Isaacs --- vortex-compressor/src/builtins/dict/float.rs | 7 +++++++ vortex-compressor/src/builtins/dict/integer.rs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/vortex-compressor/src/builtins/dict/float.rs b/vortex-compressor/src/builtins/dict/float.rs index 9d7ee91c913..467ef567472 100644 --- a/vortex-compressor/src/builtins/dict/float.rs +++ b/vortex-compressor/src/builtins/dict/float.rs @@ -107,6 +107,13 @@ impl Scheme for FloatDictScheme { ) -> VortexResult { // 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(); diff --git a/vortex-compressor/src/builtins/dict/integer.rs b/vortex-compressor/src/builtins/dict/integer.rs index 88da5939943..de40312ca6b 100644 --- a/vortex-compressor/src/builtins/dict/integer.rs +++ b/vortex-compressor/src/builtins/dict/integer.rs @@ -100,6 +100,13 @@ impl Scheme for IntDictScheme { ) -> VortexResult { // 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.