@@ -18,6 +18,7 @@ use vortex_array::ExecutionResult;
1818use vortex_array:: IntoArray ;
1919use vortex_array:: Precision ;
2020use vortex_array:: TypedArrayRef ;
21+ use vortex_array:: array_slots;
2122use vortex_array:: arrays:: Primitive ;
2223use vortex_array:: buffer:: BufferHandle ;
2324use vortex_array:: dtype:: DType ;
@@ -79,13 +80,14 @@ impl VTable for ALP {
7980 len : usize ,
8081 slots : & [ Option < ArrayRef > ] ,
8182 ) -> VortexResult < ( ) > {
83+ let slots = ALPSlotsView :: from_slots ( slots) ;
8284 validate_parts (
8385 dtype,
8486 len,
8587 data. exponents ,
86- ALPSlotsView :: from_slots ( slots) . encoded ,
88+ slots. encoded ,
8789 patches_from_slots (
88- slots,
90+ & slots,
8991 data. patch_offset ,
9092 data. patch_offset_within_chunk ,
9193 len,
@@ -198,7 +200,7 @@ impl VTable for ALP {
198200 }
199201}
200202
201- #[ vortex_array :: array_slots( ALP ) ]
203+ #[ array_slots( ALP ) ]
202204pub struct ALPSlots {
203205 /// The ALP-encoded values array.
204206 pub encoded : ArrayRef ,
@@ -425,7 +427,7 @@ pub trait ALPArrayExt: ALPArraySlotsExt {
425427
426428 fn patches ( & self ) -> Option < Patches > {
427429 patches_from_slots (
428- self . as_ref ( ) . slots ( ) ,
430+ & self . slots_view ( ) ,
429431 self . patch_offset ,
430432 self . patch_offset_within_chunk ,
431433 self . as_ref ( ) . len ( ) ,
@@ -434,13 +436,12 @@ pub trait ALPArrayExt: ALPArraySlotsExt {
434436}
435437
436438fn patches_from_slots (
437- slots : & [ Option < ArrayRef > ] ,
439+ slots : & ALPSlotsView ,
438440 patch_offset : Option < usize > ,
439441 patch_offset_within_chunk : Option < usize > ,
440442 len : usize ,
441443) -> Option < Patches > {
442- let view = ALPSlotsView :: from_slots ( slots) ;
443- match ( view. patch_indices , view. patch_values ) {
444+ match ( slots. patch_indices , slots. patch_values ) {
444445 ( Some ( indices) , Some ( values) ) => {
445446 let patch_offset = patch_offset. vortex_expect ( "has patch slots but no patch_offset" ) ;
446447 Some ( unsafe {
@@ -449,7 +450,7 @@ fn patches_from_slots(
449450 patch_offset,
450451 indices. clone ( ) ,
451452 values. clone ( ) ,
452- view . patch_chunk_offsets . cloned ( ) ,
453+ slots . patch_chunk_offsets . cloned ( ) ,
453454 patch_offset_within_chunk,
454455 )
455456 } )
0 commit comments