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, CastExprEncoding, ExprEncodingRef,
8    GetItemExprEncoding, IsNullExprEncoding, LikeExprEncoding, ListContainsExprEncoding,
9    LiteralExprEncoding, MergeExprEncoding, NotExprEncoding, PackExprEncoding, RootExprEncoding,
10    SelectExprEncoding,
11};
12
13pub type ExprRegistry = VTableRegistry<ExprEncodingRef>;
14
15pub trait ExprRegistryExt {
16    /// Creates a default expression registry with built-in Vortex expressions pre-registered.
17    fn default() -> Self;
18}
19
20impl ExprRegistryExt for ExprRegistry {
21    fn default() -> Self {
22        let mut this = Self::empty();
23        this.register_many([
24            ExprEncodingRef::new_ref(BetweenExprEncoding.as_ref()),
25            ExprEncodingRef::new_ref(BinaryExprEncoding.as_ref()),
26            ExprEncodingRef::new_ref(CastExprEncoding.as_ref()),
27            ExprEncodingRef::new_ref(GetItemExprEncoding.as_ref()),
28            ExprEncodingRef::new_ref(IsNullExprEncoding.as_ref()),
29            ExprEncodingRef::new_ref(LikeExprEncoding.as_ref()),
30            ExprEncodingRef::new_ref(ListContainsExprEncoding.as_ref()),
31            ExprEncodingRef::new_ref(LiteralExprEncoding.as_ref()),
32            ExprEncodingRef::new_ref(MergeExprEncoding.as_ref()),
33            ExprEncodingRef::new_ref(NotExprEncoding.as_ref()),
34            ExprEncodingRef::new_ref(PackExprEncoding.as_ref()),
35            ExprEncodingRef::new_ref(RootExprEncoding.as_ref()),
36            ExprEncodingRef::new_ref(SelectExprEncoding.as_ref()),
37        ]);
38        this
39    }
40}