File tree Expand file tree Collapse file tree
vortex-array/src/arrays/scalar_fn/vtable
vortex-layout/src/layouts/dict Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,12 +14,36 @@ use crate::LEGACY_SESSION;
1414use crate :: arrays:: scalar_fn:: array:: ScalarFnArray ;
1515use crate :: arrays:: scalar_fn:: vtable:: ScalarFnVTable ;
1616use crate :: executor:: VectorExecutor ;
17+ use crate :: expr:: ExecutionArgs ;
1718use crate :: validity:: Validity ;
1819use crate :: vtable:: ValidityVTable ;
1920
2021impl 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 {
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments