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