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