Skip to main content

reset_plan_states

Function reset_plan_states 

Source
pub fn reset_plan_states(
    plan: Arc<dyn ExecutionPlan>,
) -> Result<Arc<dyn ExecutionPlan>, DataFusionError>
Expand description

Make plan ready to be re-executed returning its clone with state reset for all nodes.

Some plans will change their internal states after execution, making them unable to be executed again. This function uses ExecutionPlan::reset_state to reset any internal state within the plan.

An example is CrossJoinExec, which loads the left table into memory and stores it in the plan. However, if the data of the left table is derived from the work table, it will become outdated as the work table changes. When the next iteration executes this plan again, we must clear the left table.

ยงLimitations

While this function enables plan reuse, it does not allow the same plan to be executed if it (OR):

  • uses dynamic filters,
  • represents a recursive query.