Skip to main content

vortex_sequence/compute/
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::arrays::SliceReduce;
8use vortex_error::VortexResult;
9
10use crate::SequenceArray;
11use crate::SequenceVTable;
12
13impl SliceReduce for SequenceVTable {
14    fn slice(array: &Self::Array, range: Range<usize>) -> VortexResult<Option<ArrayRef>> {
15        Ok(Some(
16            SequenceArray::unchecked_new(
17                array.index_value(range.start),
18                array.multiplier(),
19                array.ptype(),
20                array.dtype().nullability(),
21                range.len(),
22            )
23            .to_array(),
24        ))
25    }
26}