Skip to main content

series_execution_plan

Function series_execution_plan 

Source
pub fn series_execution_plan(
    plan: &dyn ExecutionPlan,
) -> Option<&dyn SeriesExecutionPlan>
Expand description

plan as a native series operator, when it is one.

This is the guard a native consumer asks before it decides how to read its input, and it is deliberately the list of operators this crate implements the trait on: a plan that is not in the list is read as frames, so a consumer’s fast path can never outrun the operators that support it. It is the only place that decision is made - a consumer that asks this per input has nothing to keep in step with it, and no plan is read in process because something else said so.

The obvious spelling - erasing the plan and asking it for dyn SeriesExecutionPlan - cannot be written, and not because of the DataFusion this crate builds against: [Any::downcast_ref] wants T: Sized and compares the type id of a concrete type, so a trait object can never be its target and the call would not compile anywhere. The check therefore names the concrete implementors it accepts, one downcast_ref per operator, which is why the trait exposes SeriesExecutionPlan::as_any and why the question below starts from dyn Any rather than from dyn ExecutionPlan: this DataFusion’s [ExecutionPlan] declares no as_any, but it is Any, so the view is one upcast away. The decision stays in this one function: a new implementor is added here, and until it is, a consumer reads that plan as frames.