Skip to main content

vortex_array/arrays/bool/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::IntoArray;
10use crate::arrays::BoolArray;
11use crate::arrays::BoolVTable;
12use crate::arrays::SliceReduce;
13use crate::vtable::ValidityHelper;
14
15impl SliceReduce for BoolVTable {
16    fn slice(array: &Self::Array, range: Range<usize>) -> VortexResult<Option<ArrayRef>> {
17        Ok(Some(
18            BoolArray::new(
19                array.to_bit_buffer().slice(range.clone()),
20                array.validity().slice(range)?,
21            )
22            .into_array(),
23        ))
24    }
25}