@@ -7,7 +7,9 @@ use vortex_array::patches::{Patches, PatchesMetadata};
77use vortex_array:: stats:: StatsSet ;
88use vortex_array:: validity:: { ArrayValidity , Validity } ;
99use vortex_array:: visitor:: ArrayVisitor ;
10- use vortex_array:: vtable:: { StatisticsVTable , ValidateVTable , ValidityVTable , VisitorVTable } ;
10+ use vortex_array:: vtable:: {
11+ CanonicalVTable , StatisticsVTable , ValidateVTable , ValidityVTable , VisitorVTable ,
12+ } ;
1113use vortex_array:: {
1214 impl_encoding, ArrayDType , ArrayData , ArrayLen , Canonical , IntoCanonical , SerdeMetadata ,
1315} ;
@@ -194,35 +196,35 @@ impl ALPRDArray {
194196 }
195197}
196198
197- impl IntoCanonical for ALPRDArray {
198- fn into_canonical ( self ) -> VortexResult < Canonical > {
199- let left_parts = self . left_parts ( ) . into_canonical ( ) ?. into_primitive ( ) ?;
200- let right_parts = self . right_parts ( ) . into_canonical ( ) ?. into_primitive ( ) ?;
199+ impl CanonicalVTable < ALPRDArray > for ALPRDEncoding {
200+ fn into_canonical ( & self , array : ALPRDArray ) -> VortexResult < Canonical > {
201+ let left_parts = array . left_parts ( ) . into_canonical ( ) ?. into_primitive ( ) ?;
202+ let right_parts = array . right_parts ( ) . into_canonical ( ) ?. into_primitive ( ) ?;
201203
202204 // Decode the left_parts using our builtin dictionary.
203- let left_parts_dict = & self . metadata ( ) . dict [ 0 ..self . metadata ( ) . dict_len as usize ] ;
205+ let left_parts_dict = & array . metadata ( ) . dict [ 0 ..array . metadata ( ) . dict_len as usize ] ;
204206
205- let decoded_array = if self . is_f32 ( ) {
207+ let decoded_array = if array . is_f32 ( ) {
206208 PrimitiveArray :: new (
207209 alp_rd_decode :: < f32 > (
208210 left_parts. into_buffer :: < u16 > ( ) ,
209211 left_parts_dict,
210- self . metadata ( ) . right_bit_width ,
212+ array . metadata ( ) . right_bit_width ,
211213 right_parts. into_buffer_mut :: < u32 > ( ) ,
212- self . left_parts_patches ( ) ,
214+ array . left_parts_patches ( ) ,
213215 ) ?,
214- Validity :: from_mask ( self . logical_validity ( ) ?, self . dtype ( ) . nullability ( ) ) ,
216+ Validity :: from_mask ( array . logical_validity ( ) ?, array . dtype ( ) . nullability ( ) ) ,
215217 )
216218 } else {
217219 PrimitiveArray :: new (
218220 alp_rd_decode :: < f64 > (
219221 left_parts. into_buffer :: < u16 > ( ) ,
220222 left_parts_dict,
221- self . metadata ( ) . right_bit_width ,
223+ array . metadata ( ) . right_bit_width ,
222224 right_parts. into_buffer_mut :: < u64 > ( ) ,
223- self . left_parts_patches ( ) ,
225+ array . left_parts_patches ( ) ,
224226 ) ?,
225- Validity :: from_mask ( self . logical_validity ( ) ?, self . dtype ( ) . nullability ( ) ) ,
227+ Validity :: from_mask ( array . logical_validity ( ) ?, array . dtype ( ) . nullability ( ) ) ,
226228 )
227229 } ;
228230
0 commit comments