risingwave_frontend::optimizer::plan_node

Trait EndoPlan

source
pub trait EndoPlan: Endo<PlanRef> {
    // Required method
    fn cached<F>(&mut self, plan: PlanRef, f: F) -> PlanRef
       where F: FnMut(&mut Self) -> PlanRef;

    // Provided method
    fn dag_apply(&mut self, plan: PlanRef) -> PlanRef { ... }
}
Expand description

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.

Note: Due to the way super trait is designed in rust, one need to have separate implementation blocks of Endo<PlanRef> and EndoPlan. And conventionally the real transformation apply is under Endo<PlanRef>, although one can refer to dag_apply in the implementation of apply.

Required Methods§

source

fn cached<F>(&mut self, plan: PlanRef, f: F) -> PlanRef
where F: FnMut(&mut Self) -> PlanRef,

Provided Methods§

source

fn dag_apply(&mut self, plan: PlanRef) -> PlanRef

Object Safety§

This trait is not object safe.

Implementors§