Skip to main content

VortexExpr

Trait VortexExpr 

Source
pub trait VortexExpr:
    'static
    + Send
    + Sync
    + Debug
    + DisplayAs
    + DynEq
    + DynHash
    + AnalysisExpr
    + Sealed {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn to_expr(&self) -> ExprRef;
    fn encoding(&self) -> ExprEncodingRef;
    fn unchecked_evaluate(&self, ctx: &Scope) -> VortexResult<ArrayRef>;
    fn children(&self) -> Vec<&ExprRef> ;
    fn with_children(
        self: Arc<Self>,
        children: Vec<ExprRef>,
    ) -> VortexResult<ExprRef>;
    fn return_dtype(&self, scope: &DType) -> VortexResult<DType>;
    fn operator(&self, scope: &OperatorRef) -> VortexResult<Option<OperatorRef>>;

    // Provided method
    fn metadata(&self) -> Option<Vec<u8>> { ... }
}
Expand description

Represents logical operation on ArrayRefs

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Convert expression reference to reference of Any type

Source

fn to_expr(&self) -> ExprRef

Convert the expression to an ExprRef.

Source

fn encoding(&self) -> ExprEncodingRef

Return the encoding of the expression.

Source

fn unchecked_evaluate(&self, ctx: &Scope) -> VortexResult<ArrayRef>

Compute result of expression on given batch producing a new batch

“Unchecked” means that this function lacks a debug assertion that the returned array matches the VortexExpr::return_dtype method. Use instead the VortexExpr::evaluate. function which includes such an assertion.

Source

fn children(&self) -> Vec<&ExprRef>

Returns the children of this expression.

Source

fn with_children( self: Arc<Self>, children: Vec<ExprRef>, ) -> VortexResult<ExprRef>

Returns a new instance of this expression with the children replaced.

Source

fn return_dtype(&self, scope: &DType) -> VortexResult<DType>

Compute the type of the array returned by VortexExpr::evaluate.

Source

fn operator(&self, scope: &OperatorRef) -> VortexResult<Option<OperatorRef>>

Provided Methods§

Source

fn metadata(&self) -> Option<Vec<u8>>

Serialize the metadata of this expression into a bytes vector.

Returns None if the expression does not support serialization.

Implementations§

Source§

impl dyn VortexExpr + '_

Source

pub fn id(&self) -> ExprId

Source

pub fn is<V: VTable>(&self) -> bool

Source

pub fn as_<V: VTable>(&self) -> &V::Expr

Source

pub fn as_opt<V: VTable>(&self) -> Option<&V::Expr>

Source

pub fn evaluate(&self, scope: &Scope) -> VortexResult<ArrayRef>

Compute result of expression on given batch producing a new batch

Source

pub fn display_tree(&self) -> impl Display

Display the expression as a formatted tree structure.

This provides a hierarchical view of the expression that shows the relationships between parent and child expressions, making complex nested expressions easier to understand and debug.

§Example
// Build a complex nested expression
let complex_expr = select(
    ["result"],
    and(
        not(eq(get_item("status", root()), lit("inactive"))),
        and(
            LikeExpr::new(get_item("name", root()), lit("%admin%"), false, false).into_expr(),
            gt(
                cast(get_item("score", root()), DType::Primitive(PType::F64, Nullability::NonNullable)),
                lit(75.0)
            )
        )
    )
);

println!("{}", complex_expr.display_tree());

This produces output like:

Select(include): {result}
└── Binary(and)
    ├── lhs: Not
    │   └── Binary(=)
    │       ├── lhs: GetItem(status)
    │       │   └── Root
    │       └── rhs: Literal(value: "inactive", dtype: utf8)
    └── rhs: Binary(and)
        ├── lhs: Like
        │   ├── child: GetItem(name)
        │   │   └── Root
        │   └── pattern: Literal(value: "%admin%", dtype: utf8)
        └── rhs: Binary(>)
            ├── lhs: Cast(target: f64)
            │   └── GetItem(score)
            │       └── Root
            └── rhs: Literal(value: 75f64, dtype: f64)

Trait Implementations§

Source§

impl AsRef<dyn VortexExpr> for BetweenExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for BinaryExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for CastExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for ConcatExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for DynamicComparisonExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for GetItemExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for IsNullExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for LikeExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for ListContainsExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for LiteralExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for MergeExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for NotExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for PackExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for RootExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn VortexExpr> for SelectExpr

Source§

fn as_ref(&self) -> &dyn VortexExpr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Display for dyn VortexExpr + '_

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for dyn VortexExpr

Source§

impl ExprSerializeProtoExt for dyn VortexExpr + '_

Source§

fn serialize_proto(&self) -> VortexResult<Expr>

Serialize the expression to its protobuf representation.
Source§

impl<'hash> Hash for dyn VortexExpr + 'hash

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
Source§

impl<'hash> Hash for dyn VortexExpr + Send + 'hash

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
Source§

impl<'hash> Hash for dyn VortexExpr + Send + Sync + 'hash

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
Source§

impl<'hash> Hash for dyn VortexExpr + Sync + 'hash

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
Source§

impl PartialEq for dyn VortexExpr

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§