Skip to main content

vortex_zigzag/
slice.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use std::ops::Range;
5
6use vortex_array::ArrayRef;
7use vortex_array::IntoArray;
8use vortex_array::arrays::SliceReduce;
9use vortex_error::VortexResult;
10
11use crate::ZigZagArray;
12use crate::ZigZagVTable;
13
14impl SliceReduce for ZigZagVTable {
15    fn slice(array: &Self::Array, range: Range<usize>) -> VortexResult<Option<ArrayRef>> {
16        Ok(Some(
17            ZigZagArray::new(array.encoded().slice(range)?).into_array(),
18        ))
19    }
20}