vortex_expr/
registry.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use vortex_array::VTableRegistry;
5
6use crate::{
7    BetweenExprEncoding, BinaryExprEncoding, ExprEncodingRef, GetItemExprEncoding,
8    LikeExprEncoding, ListContainsExprEncoding, LiteralExprEncoding, MergeExprEncoding,
9    NotExprEncoding, PackExprEncoding, RootExprEncoding, SelectExprEncoding,
10};
11
12pub type ExprRegistry = VTableRegistry<ExprEncodingRef>;
13
14pub trait ExprRegistryExt {
15    /// Creates a default expression registry with built-in Vortex expressions pre-registered.
16    fn default() -> Self;
17}
18
19impl ExprRegistryExt for ExprRegistry {
20    fn default() -> Self {
21        let mut this = Self::empty();
22        this.register_many([
23            ExprEncodingRef::new_ref(BetweenExprEncoding.as_ref()),
24            ExprEncodingRef::new_ref(BinaryExprEncoding.as_ref()),
25            ExprEncodingRef::new_ref(GetItemExprEncoding.as_ref()),
26            // ExprEncodingRef::new_ref(IdentityExprEncoding.as_ref()),
27            ExprEncodingRef::new_ref(LikeExprEncoding.as_ref()),
28            ExprEncodingRef::new_ref(LiteralExprEncoding.as_ref()),
29            ExprEncodingRef::new_ref(ListContainsExprEncoding.as_ref()),
30            ExprEncodingRef::new_ref(MergeExprEncoding.as_ref()),
31            ExprEncodingRef::new_ref(NotExprEncoding.as_ref()),
32            ExprEncodingRef::new_ref(PackExprEncoding.as_ref()),
33            ExprEncodingRef::new_ref(SelectExprEncoding.as_ref()),
34            ExprEncodingRef::new_ref(RootExprEncoding.as_ref()),
35        ]);
36        this
37    }
38}