pub trait ExecutionPlanVisitor {
    type Error;

    // Required method
    fn pre_visit(
        &mut self,
        plan: &dyn ExecutionPlan
    ) -> Result<bool, Self::Error>;

    // Provided method
    fn post_visit(
        &mut self,
        _plan: &dyn ExecutionPlan
    ) -> Result<bool, Self::Error> { ... }
}
Expand description

Trait that implements the Visitor pattern for a depth first walk of ExecutionPlan nodes. pre_visit is called before any children are visited, and then post_visit is called after all children have been visited. To use, define a struct that implements this trait and then invoke [‘accept’].

For example, for an execution plan that looks like:

ProjectionExec: id
   FilterExec: state = CO
      CsvExec:

The sequence of visit operations would be:

visitor.pre_visit(ProjectionExec)
visitor.pre_visit(FilterExec)
visitor.pre_visit(CsvExec)
visitor.post_visit(CsvExec)
visitor.post_visit(FilterExec)
visitor.post_visit(ProjectionExec)

Required Associated Types§

source

type Error

The type of error returned by this visitor

Required Methods§

source

fn pre_visit(&mut self, plan: &dyn ExecutionPlan) -> Result<bool, Self::Error>

Invoked on an ExecutionPlan plan before any of its child inputs have been visited. If Ok(true) is returned, the recursion continues. If Err(..) or Ok(false) are returned, the recursion stops immediately and the error, if any, is returned to accept

Provided Methods§

source

fn post_visit(&mut self, _plan: &dyn ExecutionPlan) -> Result<bool, Self::Error>

Invoked on an ExecutionPlan plan after all of its child inputs have been visited. The return value is handled the same as the return value of pre_visit. The provided default implementation returns Ok(true).

Implementors§