vortex_fastlanes/for/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_array::ArrayEq;
7use vortex_array::ArrayHash;
8use vortex_array::Precision;
9use vortex_array::stats::StatsSetRef;
10use vortex_array::vtable::BaseArrayVTable;
11use vortex_dtype::DType;
12
13use super::FoRVTable;
14use crate::FoRArray;
15
16impl BaseArrayVTable<FoRVTable> for FoRVTable {
17    fn len(array: &FoRArray) -> usize {
18        array.encoded().len()
19    }
20
21    fn dtype(array: &FoRArray) -> &DType {
22        array.reference_scalar().dtype()
23    }
24
25    fn stats(array: &FoRArray) -> StatsSetRef<'_> {
26        array.stats_set().to_ref(array.as_ref())
27    }
28
29    fn array_hash<H: std::hash::Hasher>(array: &FoRArray, state: &mut H, precision: Precision) {
30        array.encoded().array_hash(state, precision);
31        array.reference_scalar().hash(state);
32    }
33
34    fn array_eq(array: &FoRArray, other: &FoRArray, precision: Precision) -> bool {
35        array.encoded().array_eq(other.encoded(), precision)
36            && array.reference_scalar() == other.reference_scalar()
37    }
38}