Skip to main content

vortex_array/arrays/widen/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_error::VortexResult;
7
8use crate::ArrayRef;
9use crate::array::ArrayView;
10use crate::arrays::Widen;
11use crate::arrays::slice::SliceReduce;
12use crate::arrays::widen::WidenArraySlotsExt;
13use crate::arrays::widen::compute::wrap_values;
14
15impl SliceReduce for Widen {
16    fn slice(array: ArrayView<'_, Self>, range: Range<usize>) -> VortexResult<Option<ArrayRef>> {
17        let values = array.values().slice(range)?;
18        wrap_values(values, array.dtype().clone()).map(Some)
19    }
20}