44use std:: mem:: transmute;
55
66use vortex_array:: ExecutionCtx ;
7- use vortex_array:: ToCanonical ;
87use vortex_array:: arrays:: PrimitiveArray ;
98use vortex_array:: arrays:: primitive:: chunk_range;
109use vortex_array:: arrays:: primitive:: patch_chunk;
@@ -33,14 +32,10 @@ pub fn decompress_into_array(
3332 if let Some ( ref patches) = patches
3433 && let Some ( chunk_offsets) = patches. chunk_offsets ( )
3534 {
36- let prim_encoded = encoded. to_primitive ( ) ;
37- // We need to drop ALPArray here in case converting encoded buffer into
38- // primitive didn't create a copy. In that case both alp_encoded and array
39- // will hold a reference to the buffer we want to mutate.
40- drop ( encoded) ;
41- let patches_chunk_offsets = chunk_offsets. as_ref ( ) . to_primitive ( ) ;
42- let patches_indices = patches. indices ( ) . to_primitive ( ) ;
43- let patches_values = patches. values ( ) . to_primitive ( ) ;
35+ let prim_encoded = encoded. execute :: < PrimitiveArray > ( ctx) ?;
36+ let patches_chunk_offsets = chunk_offsets. clone ( ) . execute :: < PrimitiveArray > ( ctx) ?;
37+ let patches_indices = patches. indices ( ) . clone ( ) . execute :: < PrimitiveArray > ( ctx) ?;
38+ let patches_values = patches. values ( ) . clone ( ) . execute :: < PrimitiveArray > ( ctx) ?;
4439 Ok ( decompress_chunked_core (
4540 prim_encoded,
4641 exponents,
@@ -51,11 +46,7 @@ pub fn decompress_into_array(
5146 dtype,
5247 ) )
5348 } else {
54- let encoded_prim = encoded. to_primitive ( ) ;
55- // We need to drop ALPArray here in case converting encoded buffer into
56- // primitive didn't create a copy. In that case both alp_encoded and array
57- // will hold a reference to the buffer we want to mutate.
58- drop ( encoded) ;
49+ let encoded_prim = encoded. execute :: < PrimitiveArray > ( ctx) ?;
5950 decompress_unchunked_core ( encoded_prim, exponents, patches, dtype, ctx)
6051 }
6152}
0 commit comments