Operator

Trait Operator 

Source
pub trait Operator:
    'static
    + Send
    + Sync
    + Debug
    + DynOperatorHash
    + DynOperatorEq {
Show 14 methods // Required methods fn id(&self) -> OperatorId; fn as_any(&self) -> &dyn Any; fn dtype(&self) -> &DType; fn len(&self) -> usize; fn children(&self) -> &[OperatorRef] ; fn with_children( self: Arc<Self>, _children: Vec<OperatorRef>, ) -> VortexResult<OperatorRef>; // Provided methods fn is_empty(&self) -> bool { ... } fn nchildren(&self) -> usize { ... } fn fmt_as(&self, _df: DisplayFormat, f: &mut Formatter<'_>) -> Result { ... } fn reduce_children(&self) -> VortexResult<Option<OperatorRef>> { ... } fn reduce_parent( &self, _parent: OperatorRef, _child_idx: usize, ) -> VortexResult<Option<OperatorRef>> { ... } fn is_selection_target(&self, _child_idx: usize) -> Option<bool> { ... } fn as_batch(&self) -> Option<&dyn BatchOperator> { ... } fn as_pipelined(&self) -> Option<&dyn PipelinedOperator> { ... }
}
Expand description

An operator represents a node in a logical query plan.

Required Methods§

Source

fn id(&self) -> OperatorId

The unique identifier for this operator instance.

Source

fn as_any(&self) -> &dyn Any

For downcasting.

Source

fn dtype(&self) -> &DType

Returns the DType of the array produced by this operator.

Source

fn len(&self) -> usize

Returns the number of rows produced by this operator.

Source

fn children(&self) -> &[OperatorRef]

The children of this operator.

Source

fn with_children( self: Arc<Self>, _children: Vec<OperatorRef>, ) -> VortexResult<OperatorRef>

Create a new instance of this operator with the given children.

§Panics

Panics if the number or dtypes of children are incorrect.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns whether this operator produces zero rows.

Source

fn nchildren(&self) -> usize

The number of children of this operator.

Source

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

Override the default formatting of this operator.

Source

fn reduce_children(&self) -> VortexResult<Option<OperatorRef>>

Attempt to optimize this node by analyzing its children.

For example, if all the children are constant, this function should perform constant folding and return a constant operator.

This function should typically be implemented only for self-contained optimizations based on child properties

Source

fn reduce_parent( &self, _parent: OperatorRef, _child_idx: usize, ) -> VortexResult<Option<OperatorRef>>

Attempt to push down a parent operator through this node.

The child_idx parameter indicates which child of the parent this operator occupies. For example, if the parent is a binary operator, and this operator is the left child, then child_idx will be 0. If this operator is the right child, then child_idx will be 1.

The returned operator will replace the parent in the tree.

This function should typically be implemented for cross-operator optimizations where the child needs to adapt to the parent’s requirements

Source

fn is_selection_target(&self, _child_idx: usize) -> Option<bool>

Return true if the given child is considered to be a selection target.

The definition of this is such that pushing a selection operator down to all selection targets will result in the same output as a selection on this operator.

For example, select(Op, mask) == Op(select(child, mask), ...) for all children that are selection targets.

If any child index returns None, then selection pushdown is not possible. If all children return Some(false), then selection pushdown is not possible.

Source

fn as_batch(&self) -> Option<&dyn BatchOperator>

Returns this operator as a BatchOperator if it supports batch execution.

Source

fn as_pipelined(&self) -> Option<&dyn PipelinedOperator>

Returns this operator as a PipelinedOperator if it supports pipelined execution.

Note that operators that implement PipelinedOperator do not need to implement BatchOperator, although they may choose to do so.

Implementations§

Source§

impl dyn Operator + '_

Source

pub fn display_tree(&self) -> impl Display

Source§

impl dyn Operator + '_

Source

pub fn optimize(self: Arc<Self>) -> VortexResult<OperatorRef>

Optimize the operator tree rooted at this operator by applying local optimizations such as reducing redundant operators.

Trait Implementations§

Source§

impl OperatorEq for dyn Operator + '_

Source§

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

Source§

impl OperatorHash for dyn Operator + '_

Source§

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

Implementors§