Skip to content

Commit c6ed47f

Browse files
fix[dict]: min_max must not be null (#5560)
Signed-off-by: Joe Isaacs <[email protected]>
1 parent 4bbc879 commit c6ed47f

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

fuzz/fuzz_targets/file_io.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ fuzz_target!(|fuzz: FuzzFileAction| -> Corpus {
100100
assert_eq!(
101101
expected_array.len(),
102102
output_array.len(),
103-
"Length was not preserved."
103+
"Length was not preserved expected {} actual {}.",
104+
expected_array.len(),
105+
output_array.len()
104106
);
105107
assert_eq!(
106108
expected_array.dtype(),
107109
output_array.dtype(),
108-
"DTypes aren't preserved expected {}, actual {}",
110+
"DTypes aren't preserved expected {}, actual {}.",
109111
expected_array.dtype(),
110112
output_array.dtype()
111113
);

vortex-array/src/expr/exprs/get_item/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl VTable for GetItem {
8080
}
8181

8282
fn fmt_data(&self, instance: &Self::Instance, f: &mut Formatter<'_>) -> std::fmt::Result {
83-
write!(f, "\"{}\"", instance.inner().as_ref())
83+
write!(f, "\"{}\"", instance)
8484
}
8585

8686
fn return_dtype(&self, expr: &ExpressionView<Self>, scope: &DType) -> VortexResult<DType> {

vortex-array/src/mask_future.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ impl MaskFuture {
6868
let inner = self.inner.clone();
6969
Self::new(range.len(), async move { Ok(inner.await?.slice(range)) })
7070
}
71+
72+
pub fn inspect(
73+
self,
74+
f: impl FnOnce(&SharedVortexResult<Mask>) + 'static + Send + Sync,
75+
) -> Self {
76+
let len = self.len;
77+
78+
Self {
79+
inner: self.inner.inspect(f).boxed().shared(),
80+
len,
81+
}
82+
}
7183
}
7284

7385
impl Future for MaskFuture {

vortex-layout/src/layouts/dict/reader.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,16 @@ impl LayoutReader for DictReader {
174174
let mask = mask.await?;
175175

176176
// Short-circuit when the values are all true/false.
177-
if let Some(MinMaxResult { min, max }) = min_max(&values)? {
178-
if !max.as_bool().value().unwrap_or(true) {
177+
if values.all_valid()
178+
&& let Some(MinMaxResult { min, max }) = min_max(&values)?
179+
{
180+
#[expect(clippy::bool_comparison, reason = "easy to follow")]
181+
if max.as_bool().value().vortex_expect("non null") == false {
179182
// All values are false
180183
return Ok(Mask::AllFalse(mask.len()));
181184
}
182-
if min.as_bool().value().unwrap_or(false) {
185+
#[expect(clippy::bool_comparison, reason = "easy to follow")]
186+
if min.as_bool().value().vortex_expect("not null") == true {
183187
// All values are true, but we still need to respect codes validity
184188
return Ok(mask.bitand(&codes.validity_mask()));
185189
}

0 commit comments

Comments
 (0)