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 ArrayRef
s
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)