vortex_array/arrays/decimal/compute/
mask.rs1use vortex_error::VortexResult;
5
6use crate::ArrayRef;
7use crate::IntoArray;
8use crate::array::ArrayView;
9use crate::arrays::Decimal;
10use crate::arrays::DecimalArray;
11use crate::match_each_decimal_value_type;
12use crate::scalar_fn::fns::mask::MaskReduce;
13use crate::validity::Validity;
14
15impl MaskReduce for Decimal {
16 fn mask(array: ArrayView<'_, Decimal>, mask: &ArrayRef) -> VortexResult<Option<ArrayRef>> {
17 Ok(Some(match_each_decimal_value_type!(
18 array.values_type(),
19 |D| {
20 unsafe {
22 DecimalArray::new_unchecked(
23 array.buffer::<D>(),
24 array.decimal_dtype(),
25 array.validity()?.and(Validity::Array(mask.clone()))?,
26 )
27 }
28 .into_array()
29 }
30 )))
31 }
32}