vortex_array/vtable/
canonical.rs1use vortex_error::vortex_panic;
5
6use crate::Canonical;
7use crate::builders::ArrayBuilder;
8use crate::vtable::NotSupported;
9use crate::vtable::VTable;
10
11pub trait CanonicalVTable<V: VTable> {
12 fn canonicalize(array: &V::Array) -> Canonical;
19
20 fn append_to_builder(array: &V::Array, builder: &mut dyn ArrayBuilder) {
25 let canonical = Self::canonicalize(array);
26 builder.extend_from_array(canonical.as_ref())
27 }
28}
29
30impl<V: VTable> CanonicalVTable<V> for NotSupported {
31 fn canonicalize(array: &V::Array) -> Canonical {
32 vortex_panic!(
33 "Legacy canonicalize is not supported for {} arrays",
34 array.encoding_id()
35 )
36 }
37}