pub trait PlanTreeNode {
// Required methods
fn inputs(&self) -> SmallVec<[PlanRef; 2]>;
fn clone_with_inputs(&self, inputs: &[PlanRef]) -> PlanRef;
}
Expand description
The trait PlanNode
really need about tree structure and used by optimizer
framework. every plan node should impl it.
The trait PlanTreeNodeLeaf
, PlanTreeNodeUnary
and PlanTreeNodeBinary
, is just
special cases for PlanTreeNode
. as long as you impl these trait for a plan node, we can
easily impl the PlanTreeNode
which is really need by framework with helper macros
impl_plan_tree_node_for_leaf
, impl_plan_tree_node_for_unary
and
impl_plan_tree_node_for_binary
. We can’t auto impl PlanTreeNode for PlanTreeNodeLeaf/Unary/Binary
, because compiler doesn’t know they are disjoint and thinks there
are conflicting implementation.
And due to these three traits need not be used as dyn, it can return Self
type, which is
useful when implement rules and visitors. So we highly recommend not impl the PlanTreeNode
trait directly, instead use these tree trait and impl PlanTreeNode
use these helper
macros.
Required Methods§
sourcefn clone_with_inputs(&self, inputs: &[PlanRef]) -> PlanRef
fn clone_with_inputs(&self, inputs: &[PlanRef]) -> PlanRef
Clone the node with a list of new inputs.