pub trait ReduceNode: Clone {
// Required methods
fn node_dtype(&self) -> VortexResult<DType>;
fn scalar_fn(&self) -> Option<&ScalarFnRef>;
fn child(&self, idx: usize) -> Self;
fn child_count(&self) -> usize;
fn new_node(
&self,
scalar_fn: ScalarFnRef,
children: &[Self],
) -> VortexResult<Self>;
fn new_constant(&self, value: Scalar) -> Self;
fn validity(&self) -> VortexResult<ReduceNodeValidity<Self>>
where Self: Sized;
// Provided method
fn as_constant(&self) -> Option<Scalar> { ... }
}Expand description
A node used for implementing abstract reduction rules over a tree of scalar functions.
Reduction rules are generic over the node type, so a rule is written once and monomorphized
per reducible tree kind: ExpressionReduceNode for bound expression trees and
ArrayReduceNode for array trees. Nodes borrow from the tree being reduced, making
traversal allocation-free, while nodes produced by ReduceNode::new_node own their
freshly-built subtrees.
Required Methods§
Sourcefn node_dtype(&self) -> VortexResult<DType>
fn node_dtype(&self) -> VortexResult<DType>
Return the data type of this node.
Sourcefn scalar_fn(&self) -> Option<&ScalarFnRef>
fn scalar_fn(&self) -> Option<&ScalarFnRef>
Return this node’s scalar function if it is indeed a scalar fn.
Sourcefn child_count(&self) -> usize
fn child_count(&self) -> usize
Returns the number of children of this node.
Sourcefn new_node(
&self,
scalar_fn: ScalarFnRef,
children: &[Self],
) -> VortexResult<Self>
fn new_node( &self, scalar_fn: ScalarFnRef, children: &[Self], ) -> VortexResult<Self>
Create a new node from the given scalar function and children, inheriting this node’s reduction context (e.g. the expression scope, or the array row count).
Sourcefn new_constant(&self, value: Scalar) -> Self
fn new_constant(&self, value: Scalar) -> Self
Produce a new constant node in the same scope as “self”
Sourcefn validity(&self) -> VortexResult<ReduceNodeValidity<Self>>where
Self: Sized,
fn validity(&self) -> VortexResult<ReduceNodeValidity<Self>>where
Self: Sized,
Symbolic validity of this node. Reduced() if you can get from node’s validity to validity of its children or a constant without evaluating node.
Provided Methods§
Sourcefn as_constant(&self) -> Option<Scalar>
fn as_constant(&self) -> Option<Scalar>
Return a scalar value if this node is constant
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".