33
44use vortex_array:: Array ;
55use vortex_array:: ArrayRef ;
6+ use vortex_array:: ExecutionCtx ;
67use vortex_array:: IntoArray ;
7- use vortex_array:: compute:: TakeKernel ;
8- use vortex_array:: compute:: TakeKernelAdapter ;
8+ use vortex_array:: arrays:: TakeExecute ;
99use vortex_array:: compute:: fill_null;
10- use vortex_array:: compute:: take;
11- use vortex_array:: register_kernel;
1210use vortex_error:: VortexResult ;
1311use vortex_scalar:: Scalar ;
1412use vortex_scalar:: ScalarValue ;
1513
1614use crate :: ALPRDArray ;
1715use crate :: ALPRDVTable ;
1816
19- impl TakeKernel for ALPRDVTable {
20- fn take ( & self , array : & ALPRDArray , indices : & dyn Array ) -> VortexResult < ArrayRef > {
21- let taken_left_parts = take ( array. left_parts ( ) , indices) ?;
17+ impl TakeExecute for ALPRDVTable {
18+ fn take (
19+ array : & ALPRDArray ,
20+ indices : & dyn Array ,
21+ _ctx : & mut ExecutionCtx ,
22+ ) -> VortexResult < Option < ArrayRef > > {
23+ let taken_left_parts = array. left_parts ( ) . take ( indices. to_array ( ) ) ?;
2224 let left_parts_exceptions = array
2325 . left_parts_patches ( )
2426 . map ( |patches| patches. take ( indices) )
@@ -33,26 +35,26 @@ impl TakeKernel for ALPRDVTable {
3335 } )
3436 . transpose ( ) ?;
3537 let right_parts = fill_null (
36- & take ( array. right_parts ( ) , indices) ?,
38+ & array. right_parts ( ) . take ( indices. to_array ( ) ) ?,
3739 & Scalar :: new ( array. right_parts ( ) . dtype ( ) . clone ( ) , ScalarValue :: from ( 0 ) ) ,
3840 ) ?;
3941
40- Ok ( ALPRDArray :: try_new (
41- array
42- . dtype ( )
43- . with_nullability ( taken_left_parts. dtype ( ) . nullability ( ) ) ,
44- taken_left_parts,
45- array. left_parts_dictionary ( ) . clone ( ) ,
46- right_parts,
47- array. right_bit_width ( ) ,
48- left_parts_exceptions,
49- ) ?
50- . into_array ( ) )
42+ Ok ( Some (
43+ ALPRDArray :: try_new (
44+ array
45+ . dtype ( )
46+ . with_nullability ( taken_left_parts. dtype ( ) . nullability ( ) ) ,
47+ taken_left_parts,
48+ array. left_parts_dictionary ( ) . clone ( ) ,
49+ right_parts,
50+ array. right_bit_width ( ) ,
51+ left_parts_exceptions,
52+ ) ?
53+ . into_array ( ) ,
54+ ) )
5155 }
5256}
5357
54- register_kernel ! ( TakeKernelAdapter ( ALPRDVTable ) . lift( ) ) ;
55-
5658#[ cfg( test) ]
5759mod test {
5860 use rstest:: rstest;
0 commit comments