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