pub trait Operator:
'static
+ Send
+ Sync
+ Debug
+ DynOperatorHash
+ DynOperatorEq {
Show 14 methods
// Required methods
fn id(&self) -> ArcRef<str>;
fn as_any(&self) -> &(dyn Any + 'static);
fn dtype(&self) -> &DType;
fn len(&self) -> usize;
fn children(&self) -> &[Arc<dyn Operator>];
fn with_children(
self: Arc<Self>,
_children: Vec<Arc<dyn Operator>>,
) -> Result<Arc<dyn Operator>, VortexError>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn nchildren(&self) -> usize { ... }
fn fmt_as(
&self,
_df: DisplayFormat,
f: &mut Formatter<'_>,
) -> Result<(), Error> { ... }
fn reduce_children(&self) -> Result<Option<Arc<dyn Operator>>, VortexError> { ... }
fn reduce_parent(
&self,
_parent: Arc<dyn Operator>,
_child_idx: usize,
) -> Result<Option<Arc<dyn Operator>>, VortexError> { ... }
fn is_selection_target(&self, _child_idx: usize) -> Option<bool> { ... }
fn as_batch(&self) -> Option<&(dyn BatchOperator + 'static)> { ... }
fn as_pipelined(&self) -> Option<&(dyn PipelinedOperator + 'static)> { ... }
}
Expand description
An operator represents a node in a logical query plan.
Required Methods§
Provided Methods§
Sourcefn fmt_as(&self, _df: DisplayFormat, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt_as(&self, _df: DisplayFormat, f: &mut Formatter<'_>) -> Result<(), Error>
Override the default formatting of this operator.
Sourcefn reduce_children(&self) -> Result<Option<Arc<dyn Operator>>, VortexError>
fn reduce_children(&self) -> Result<Option<Arc<dyn Operator>>, VortexError>
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
Sourcefn reduce_parent(
&self,
_parent: Arc<dyn Operator>,
_child_idx: usize,
) -> Result<Option<Arc<dyn Operator>>, VortexError>
fn reduce_parent( &self, _parent: Arc<dyn Operator>, _child_idx: usize, ) -> Result<Option<Arc<dyn Operator>>, VortexError>
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
Sourcefn is_selection_target(&self, _child_idx: usize) -> Option<bool>
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.
Sourcefn as_batch(&self) -> Option<&(dyn BatchOperator + 'static)>
fn as_batch(&self) -> Option<&(dyn BatchOperator + 'static)>
Returns this operator as a BatchOperator
if it supports batch execution.
Sourcefn as_pipelined(&self) -> Option<&(dyn PipelinedOperator + 'static)>
fn as_pipelined(&self) -> Option<&(dyn PipelinedOperator + 'static)>
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.