pub trait Operator:
'static
+ Send
+ Sync
+ Debug
+ DynOperatorHash
+ DynOperatorEq {
Show 16 methods
// Required methods
fn id(&self) -> OperatorId;
fn as_any(&self) -> &dyn Any;
fn dtype(&self) -> &DType;
fn bounds(&self) -> LengthBounds;
fn children(&self) -> &[OperatorRef] ⓘ;
fn with_children(
self: Arc<Self>,
_children: Vec<OperatorRef>,
) -> VortexResult<OperatorRef>;
// Provided methods
fn len(&self) -> Option<usize> { ... }
fn is_empty(&self) -> bool { ... }
fn nchildren(&self) -> usize { ... }
fn fmt_as(&self, _df: DisplayFormat, f: &mut Formatter<'_>) -> Result { ... }
fn fmt_all(&self) -> String { ... }
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§
Sourcefn id(&self) -> OperatorId
fn id(&self) -> OperatorId
The unique identifier for this operator instance.
Sourcefn bounds(&self) -> LengthBounds
fn bounds(&self) -> LengthBounds
Returns the bounds on the number of rows produced by this operator.
Sourcefn children(&self) -> &[OperatorRef] ⓘ
fn children(&self) -> &[OperatorRef] ⓘ
The children of this operator.
Sourcefn with_children(
self: Arc<Self>,
_children: Vec<OperatorRef>,
) -> VortexResult<OperatorRef>
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§
Sourcefn len(&self) -> Option<usize>
fn len(&self) -> Option<usize>
Returns the exact number of rows produced by this operator, if known.
Sourcefn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Returns if this operator is known to be empty (i.e. max bound is 0).
Sourcefn fmt_as(&self, _df: DisplayFormat, f: &mut Formatter<'_>) -> Result
fn fmt_as(&self, _df: DisplayFormat, f: &mut Formatter<'_>) -> Result
Override the default formatting of this operator.
fn fmt_all(&self) -> String
Sourcefn reduce_children(&self) -> VortexResult<Option<OperatorRef>>
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
Sourcefn reduce_parent(
&self,
_parent: OperatorRef,
_child_idx: usize,
) -> VortexResult<Option<OperatorRef>>
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
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>
fn as_batch(&self) -> Option<&dyn BatchOperator>
Returns this operator as a BatchOperator if it supports batch execution.
Sourcefn as_pipelined(&self) -> Option<&dyn PipelinedOperator>
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 + '_
impl dyn Operator + '_
Sourcepub fn optimize(self: Arc<Self>) -> VortexResult<OperatorRef>
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.