Skip to main content

ReduceNode

Trait ReduceNode 

Source
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>;
}
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 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§

Source

fn node_dtype(&self) -> VortexResult<DType>

Return the data type of this node.

Source

fn scalar_fn(&self) -> Option<&ScalarFnRef>

Return this node’s scalar function if it is indeed a scalar fn.

Source

fn child(&self, idx: usize) -> Self

Descend to the child of this node.

Source

fn child_count(&self) -> usize

Returns the number of children of this node.

Source

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).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§