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§
Sourcefn encoding(&self) -> ExprEncodingRef
fn encoding(&self) -> ExprEncodingRef
Return the encoding of the expression.
Sourcefn unchecked_evaluate(&self, ctx: &Scope) -> VortexResult<ArrayRef>
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.
Sourcefn with_children(
self: Arc<Self>,
children: Vec<ExprRef>,
) -> VortexResult<ExprRef>
fn with_children( self: Arc<Self>, children: Vec<ExprRef>, ) -> VortexResult<ExprRef>
Returns a new instance of this expression with the children replaced.
Sourcefn return_dtype(&self, scope: &DType) -> VortexResult<DType>
fn return_dtype(&self, scope: &DType) -> VortexResult<DType>
Compute the type of the array returned by
VortexExpr::evaluate.
fn operator(&self, scope: &OperatorRef) -> VortexResult<Option<OperatorRef>>
Provided Methods§
Implementations§
Source§impl dyn VortexExpr + '_
impl dyn VortexExpr + '_
pub fn id(&self) -> ExprId
pub fn is<V: VTable>(&self) -> bool
pub fn as_<V: VTable>(&self) -> &V::Expr
pub fn as_opt<V: VTable>(&self) -> Option<&V::Expr>
Sourcepub fn evaluate(&self, scope: &Scope) -> VortexResult<ArrayRef>
pub fn evaluate(&self, scope: &Scope) -> VortexResult<ArrayRef>
Compute result of expression on given batch producing a new batch
Sourcepub fn display_tree(&self) -> impl Display
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
impl AsRef<dyn VortexExpr> for BetweenExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for BinaryExpr
impl AsRef<dyn VortexExpr> for BinaryExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for CastExpr
impl AsRef<dyn VortexExpr> for CastExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for ConcatExpr
impl AsRef<dyn VortexExpr> for ConcatExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for DynamicComparisonExpr
impl AsRef<dyn VortexExpr> for DynamicComparisonExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for GetItemExpr
impl AsRef<dyn VortexExpr> for GetItemExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for IsNullExpr
impl AsRef<dyn VortexExpr> for IsNullExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for LikeExpr
impl AsRef<dyn VortexExpr> for LikeExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for ListContainsExpr
impl AsRef<dyn VortexExpr> for ListContainsExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for LiteralExpr
impl AsRef<dyn VortexExpr> for LiteralExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for MergeExpr
impl AsRef<dyn VortexExpr> for MergeExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for NotExpr
impl AsRef<dyn VortexExpr> for NotExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for PackExpr
impl AsRef<dyn VortexExpr> for PackExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for RootExpr
impl AsRef<dyn VortexExpr> for RootExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl AsRef<dyn VortexExpr> for SelectExpr
impl AsRef<dyn VortexExpr> for SelectExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Source§impl Display for dyn VortexExpr + '_
impl Display for dyn VortexExpr + '_
impl Eq for dyn VortexExpr
Source§impl ExprSerializeProtoExt for dyn VortexExpr + '_
impl ExprSerializeProtoExt for dyn VortexExpr + '_
Source§fn serialize_proto(&self) -> VortexResult<Expr>
fn serialize_proto(&self) -> VortexResult<Expr>
Source§impl<'hash> Hash for dyn VortexExpr + 'hash
impl<'hash> Hash for dyn VortexExpr + 'hash
Source§impl<'hash> Hash for dyn VortexExpr + Send + 'hash
impl<'hash> Hash for dyn VortexExpr + Send + 'hash
Source§impl<'hash> Hash for dyn VortexExpr + Sync + 'hash
impl<'hash> Hash for dyn VortexExpr + Sync + 'hash
Source§impl PartialEq for dyn VortexExpr
impl PartialEq for dyn VortexExpr
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".