risingwave_frontend::optimizer

Module plan_node

source
Expand description

Defines all kinds of node in the plan tree, each node represent a relational expression.

We use a immutable style tree structure, every Node are immutable and cannot be modified after it has been created. If you want to modify the node, such as rewriting the expression in a ProjectNode or changing a node’s input node, you need to create a new node. We use Rc as the node’s reference, and a node just storage its inputs’ reference, so change a node just need create one new node but not the entire sub-tree.

So when you want to add a new node, make sure:

  • each field in the node struct are private
  • recommend to implement the construction of Node in a unified new() function, if have multi methods to construct, make they have a consistent behavior
  • all field should be valued in construction, so the properties’ derivation should be finished in the new() function.

Re-exports§

Modules§

Macros§

Structs§

Enums§

Constants§

  • Recursion depth threshold for plan node visitor to send notice to user.
  • Notice message for plan node visitor to send to user when the depth threshold is reached.

Traits§

  • The trait for column pruning, only logical plan node will use it, though all plan node impl it.
  • A marker trait for different conventions, used for enforcing type safety.
  • A more sophisticated Endo taking into account of the DAG structure of PlanRef. In addition to Endo, one have to specify the cached function to persist transformed LogicalShare and their results, and the dag_apply function will take care to only transform every LogicalShare nodes once.
  • Rewrites expressions in a PlanRef. Due to Share operator, the ExprRewriter needs to be idempotent i.e., applying it more than once to the same ExprImpl will be a noop on subsequent applications. rewrite_exprs should only return a plan with the given node modified. To rewrite recursively, call rewrite_exprs_recursive on RewriteExprsRecursive.
  • The common trait over all plan nodes. Used by optimizer framework which will treat all node as dyn PlanNode
  • The trait for accessing the meta data and PlanBase for plan nodes.
  • The trait PlanNode really need about tree structure and used by optimizer framework. every plan node should impl it.
  • The trait for predicate pushdown, only logical plan node will use it, though all plan node impl it.
  • ToBatch allows to convert a logical plan node to batch physical node with an optional required order.
  • ToDistributedBatch allows to convert a batch physical plan to distributed batch plan, by insert exchange node, with an optional required order and distributed.
  • Converts a batch physical plan to local plan for local execution.
  • ToStream converts a logical plan node to streaming physical node with an optional required distribution.
  • A more sophisticated Visit taking into account of the DAG structure of PlanRef. In addition to Visit, one have to specify visited to store and report visited LogicalShare nodes, and the dag_visit function will take care to only visit every LogicalShare nodes once. See also EndoPlan.

Functions§