vortex_array/arrays/masked/vtable/
array.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use std::hash::Hash;
5
6use vortex_dtype::DType;
7
8use crate::Precision;
9use crate::arrays::masked::{MaskedArray, MaskedVTable};
10use crate::hash::{ArrayEq, ArrayHash};
11use crate::stats::StatsSetRef;
12use crate::vtable::ArrayVTable;
13
14impl ArrayVTable<MaskedVTable> for MaskedVTable {
15    fn len(array: &MaskedArray) -> usize {
16        array.child.len()
17    }
18
19    fn dtype(array: &MaskedArray) -> &DType {
20        &array.dtype
21    }
22
23    fn stats(array: &MaskedArray) -> StatsSetRef<'_> {
24        array.stats.to_ref(array.as_ref())
25    }
26
27    fn array_hash<H: std::hash::Hasher>(array: &MaskedArray, state: &mut H, precision: Precision) {
28        array.child.array_hash(state, precision);
29        array.validity.array_hash(state, precision);
30        array.dtype.hash(state);
31    }
32
33    fn array_eq(array: &MaskedArray, other: &MaskedArray, precision: Precision) -> bool {
34        array.child.array_eq(&other.child, precision)
35            && array.validity.array_eq(&other.validity, precision)
36            && array.dtype == other.dtype
37    }
38}