Skip to content

Commit 78a5e3b

Browse files
fix[operator]: fixed test that fail when using operators (vortex-data#5880)
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent 44fe246 commit 78a5e3b

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

vortex-array/src/arrays/scalar_fn/vtable/validity.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,36 @@ use crate::LEGACY_SESSION;
1414
use crate::arrays::scalar_fn::array::ScalarFnArray;
1515
use crate::arrays::scalar_fn::vtable::ScalarFnVTable;
1616
use crate::executor::VectorExecutor;
17+
use crate::expr::ExecutionArgs;
1718
use crate::validity::Validity;
1819
use crate::vtable::ValidityVTable;
1920

2021
impl ValidityVTable<ScalarFnVTable> for ScalarFnVTable {
2122
fn is_valid(array: &ScalarFnArray, index: usize) -> bool {
22-
array.scalar_at(index).is_valid()
23+
// inlined to remove a cycle `is_valid()` and `scalar_at()`
24+
assert!(index < array.len(), "index {index} out of bounds");
25+
let input_datums: Vec<_> = array
26+
.children()
27+
.iter()
28+
.map(|c| c.scalar_at(index))
29+
.map(|scalar| Datum::from(scalar.to_vector_scalar()))
30+
.collect();
31+
32+
let ctx = ExecutionArgs {
33+
datums: input_datums,
34+
dtypes: array.children().iter().map(|c| c.dtype().clone()).collect(),
35+
row_count: 1,
36+
return_dtype: array.dtype.clone(),
37+
};
38+
39+
let result = array
40+
.scalar_fn
41+
.execute(ctx)
42+
.vortex_expect("Scalar function execution should be fallible")
43+
.into_scalar()
44+
.vortex_expect("Scalar function execution should return scalar");
45+
46+
result.is_valid()
2347
}
2448

2549
fn all_valid(array: &ScalarFnArray) -> bool {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ mod tests {
519519
.await
520520
.unwrap();
521521
let expected = array.validity_mask().into_array();
522-
assert_arrays_eq!(actual, expected);
522+
assert_arrays_eq!(actual.to_canonical().into_array(), expected);
523523
})
524524
}
525525
}

0 commit comments

Comments
 (0)