Skip to content

Commit c2a46e5

Browse files
committed
cleanup
Signed-off-by: Andrew Duffy <andrew@a10y.dev>
1 parent a5ac920 commit c2a46e5

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

vortex-cuda/benches/alp_cuda.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use vortex::array::validity::Validity::NonNullable;
2626
use vortex::buffer::Buffer;
2727
use vortex::dtype::NativePType;
2828
use vortex::encodings::alp::ALPArray;
29+
use vortex::encodings::alp::ALPArrayExt;
2930
use vortex::encodings::alp::ALPFloat;
3031
use vortex::encodings::alp::alp_encode;
3132
use vortex::error::VortexExpect;
@@ -58,7 +59,7 @@ where
5859
};
5960
let outlier = T::from(std::f64::consts::PI).unwrap();
6061

61-
let values: Vec<T> = (0..len)
62+
let values: Buffer<T> = (0..len)
6263
.map(|i| {
6364
if patch_interval != usize::MAX && i % patch_interval == 0 {
6465
outlier
@@ -68,13 +69,22 @@ where
6869
})
6970
.collect();
7071

71-
let primitive_array = PrimitiveArray::new(Buffer::from(values), NonNullable);
72-
alp_encode(
72+
let primitive_array = PrimitiveArray::new(values, NonNullable);
73+
let encoded = alp_encode(
7374
primitive_array.as_view(),
7475
None,
7576
&mut LEGACY_SESSION.create_execution_ctx(),
7677
)
77-
.vortex_expect("failed to ALP-encode array")
78+
.vortex_expect("failed to ALP-encode array");
79+
80+
if patch_frequency > 0.0 {
81+
assert!(
82+
encoded.patches().is_some(),
83+
"expected patches for patch_frequency={patch_frequency}",
84+
);
85+
}
86+
87+
encoded
7888
}
7989

8090
fn benchmark_alp_decode_typed<T>(c: &mut Criterion, type_name: &str)

0 commit comments

Comments
 (0)