vortex_array/arrays/constant/vtable/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use crate::arrays::ConstantArray;
5use crate::vtable::{NotSupported, VTable};
6use crate::{EncodingId, EncodingRef, vtable};
7
8mod array;
9mod canonical;
10mod encode;
11mod operations;
12mod pipeline;
13mod serde;
14mod validity;
15mod visitor;
16
17vtable!(Constant);
18
19#[derive(Clone, Debug)]
20pub struct ConstantEncoding;
21
22impl VTable for ConstantVTable {
23    type Array = ConstantArray;
24    type Encoding = ConstantEncoding;
25
26    type ArrayVTable = Self;
27    type CanonicalVTable = Self;
28    type OperationsVTable = Self;
29    type ValidityVTable = Self;
30    type VisitorVTable = Self;
31    // TODO(ngates): implement a compute kernel for elementwise operations
32    type ComputeVTable = NotSupported;
33    type EncodeVTable = Self;
34    type PipelineVTable = Self;
35    type SerdeVTable = Self;
36
37    fn id(_encoding: &Self::Encoding) -> EncodingId {
38        EncodingId::new_ref("vortex.constant")
39    }
40
41    fn encoding(_array: &Self::Array) -> EncodingRef {
42        EncodingRef::new_ref(ConstantEncoding.as_ref())
43    }
44}