vortex_array/arrays/struct_/compute/
mask.rs

1use vortex_error::VortexResult;
2use vortex_mask::Mask;
3
4use crate::arrays::{StructArray, StructVTable};
5use crate::compute::{MaskKernel, MaskKernelAdapter};
6use crate::vtable::ValidityHelper;
7use crate::{ArrayRef, IntoArray, register_kernel};
8
9impl MaskKernel for StructVTable {
10    fn mask(&self, array: &StructArray, filter_mask: &Mask) -> VortexResult<ArrayRef> {
11        let validity = array.validity().mask(filter_mask)?;
12
13        StructArray::try_new_with_dtype(
14            array.fields().to_vec(),
15            array.struct_fields().clone(),
16            array.len(),
17            validity,
18        )
19        .map(|a| a.into_array())
20    }
21}
22register_kernel!(MaskKernelAdapter(StructVTable).lift());