vortex_array/arrays/dict/vtable/
array.rs1use std::hash::Hash;
5
6use vortex_dtype::DType;
7
8use super::DictVTable;
9use crate::Precision;
10use crate::arrays::dict::DictArray;
11use crate::hash::ArrayEq;
12use crate::hash::ArrayHash;
13use crate::stats::StatsSetRef;
14use crate::vtable::BaseArrayVTable;
15
16impl BaseArrayVTable<DictVTable> for DictVTable {
17 fn len(array: &DictArray) -> usize {
18 array.codes.len()
19 }
20
21 fn dtype(array: &DictArray) -> &DType {
22 &array.dtype
23 }
24
25 fn stats(array: &DictArray) -> StatsSetRef<'_> {
26 array.stats_set.to_ref(array.as_ref())
27 }
28
29 fn array_hash<H: std::hash::Hasher>(array: &DictArray, state: &mut H, precision: Precision) {
30 array.dtype.hash(state);
31 array.codes.array_hash(state, precision);
32 array.values.array_hash(state, precision);
33 }
34
35 fn array_eq(array: &DictArray, other: &DictArray, precision: Precision) -> bool {
36 array.dtype == other.dtype
37 && array.codes.array_eq(&other.codes, precision)
38 && array.values.array_eq(&other.values, precision)
39 }
40}