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