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