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::ArrayView;
8use vortex_array::IntoArray;
9use vortex_array::arrays::slice::SliceReduce;
10use vortex_error::VortexResult;
11
12use crate::ByteBool;
13
14impl SliceReduce for ByteBool {
15 fn slice(array: ArrayView<'_, Self>, range: Range<usize>) -> VortexResult<Option<ArrayRef>> {
16 Ok(Some(
17 ByteBool::new(
18 array.buffer().slice(range.clone()),
19 array.validity()?.slice(range)?,
20 )
21 .into_array(),
22 ))
23 }
24}