vortex_alp/alp/compute/
slice.rs1use std::ops::Range;
5
6use vortex_array::ArrayRef;
7use vortex_array::ArrayView;
8use vortex_array::ExecutionCtx;
9use vortex_array::IntoArray;
10use vortex_array::arrays::slice::SliceKernel;
11use vortex_error::VortexResult;
12
13use crate::ALP;
14use crate::ALPArrayExt;
15use crate::ALPArraySlotsExt;
16
17impl SliceKernel for ALP {
18 fn slice(
19 array: ArrayView<'_, Self>,
20 range: Range<usize>,
21 _ctx: &mut ExecutionCtx,
22 ) -> VortexResult<Option<ArrayRef>> {
23 let sliced_alp = ALP::new(
24 array.encoded().slice(range.clone())?,
25 array.exponents(),
26 array
27 .patches()
28 .map(|p| p.slice(range))
29 .transpose()?
30 .flatten(),
31 )
32 .into_array();
33 Ok(Some(sliced_alp))
34 }
35}