Skip to main content

vortex_bytebool/
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_array::vtable::ValidityHelper;
10use vortex_error::VortexResult;
11
12use crate::ByteBoolArray;
13use crate::ByteBoolVTable;
14
15impl SliceReduce for ByteBoolVTable {
16    fn slice(array: &ByteBoolArray, range: Range<usize>) -> VortexResult<Option<ArrayRef>> {
17        Ok(Some(
18            ByteBoolArray::new(
19                array.buffer().slice(range.clone()),
20                array.validity().slice(range)?,
21            )
22            .into_array(),
23        ))
24    }
25}