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