@@ -25,38 +25,26 @@ pub fn delta_compress(
2525) -> VortexResult < ( PrimitiveArray , PrimitiveArray ) > {
2626 let validity = array. validity ( ) ?;
2727 let original_ptype = array. ptype ( ) ;
28- let unsigned_ptype = original_ptype. to_unsigned ( ) ;
29- // Signed integers are processed through their unsigned counterpart: `wrapping_sub`
30- // is bit-identical for signed and unsigned operands, so the encoded bytes are the
31- // same regardless of how the buffer's elements are interpreted.
32- let work = if original_ptype == unsigned_ptype {
33- array. clone ( )
34- } else {
35- array. reinterpret_cast ( unsigned_ptype)
36- } ;
28+ let array = array. reinterpret_cast ( original_ptype. to_unsigned ( ) ) ;
3729
38- let ( bases, deltas) = match_each_unsigned_integer_ptype ! ( work . ptype( ) , |T | {
30+ let ( bases, deltas) = match_each_unsigned_integer_ptype ! ( array . ptype( ) , |T | {
3931 // Fill-forward null values so that transposed deltas at null positions remain
4032 // small. Without this, bitpacking may skip patches for null positions, and the
4133 // corrupted delta values propagate through the cumulative sum during decompression.
42- let filled = fill_forward_nulls( work . to_buffer:: <T >( ) , & validity, ctx) ?;
34+ let filled = fill_forward_nulls( array . to_buffer:: <T >( ) , & validity, ctx) ?;
4335 let ( bases, deltas) = compress_primitive:: <T , { T :: LANES } >( & filled) ;
4436 // TODO(robert): This can be avoided if we add TransposedBoolArray that performs index translation when necessary.
4537 let validity = transpose_validity( & validity, ctx) ?;
4638 (
47- PrimitiveArray :: new( bases, work . dtype( ) . nullability( ) . into( ) ) ,
39+ PrimitiveArray :: new( bases, array . dtype( ) . nullability( ) . into( ) ) ,
4840 PrimitiveArray :: new( deltas, validity) ,
4941 )
5042 } ) ;
5143
52- Ok ( if original_ptype == unsigned_ptype {
53- ( bases, deltas)
54- } else {
55- (
56- bases. reinterpret_cast ( original_ptype) ,
57- deltas. reinterpret_cast ( original_ptype) ,
58- )
59- } )
44+ Ok ( (
45+ bases. reinterpret_cast ( original_ptype) ,
46+ deltas. reinterpret_cast ( original_ptype) ,
47+ ) )
6048}
6149
6250fn compress_primitive < T , const LANES : usize > ( array : & [ T ] ) -> ( Buffer < T > , Buffer < T > )
0 commit comments