vortex_array/arrays/decimal/vtable/
array.rs1use vortex_dtype::DType;
5use vortex_error::vortex_panic;
6use vortex_scalar::DecimalValueType;
7
8use crate::arrays::{DecimalArray, DecimalVTable};
9use crate::stats::StatsSetRef;
10use crate::vtable::ArrayVTable;
11
12impl ArrayVTable<DecimalVTable> for DecimalVTable {
13 fn len(array: &DecimalArray) -> usize {
14 let divisor = match array.values_type {
15 DecimalValueType::I8 => 1,
16 DecimalValueType::I16 => 2,
17 DecimalValueType::I32 => 4,
18 DecimalValueType::I64 => 8,
19 DecimalValueType::I128 => 16,
20 DecimalValueType::I256 => 32,
21 ty => vortex_panic!("unknown decimal value type {:?}", ty),
22 };
23 array.values.len() / divisor
24 }
25
26 fn dtype(array: &DecimalArray) -> &DType {
27 &array.dtype
28 }
29
30 fn stats(array: &DecimalArray) -> StatsSetRef<'_> {
31 array.stats_set.to_ref(array.as_ref())
32 }
33}