Skip to main content

SeriesExecutionPlan

Trait SeriesExecutionPlan 

Source
pub trait SeriesExecutionPlan: ExecutionPlan {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn execute_series(
        &self,
        partition: usize,
        ctx: Arc<TaskContext>,
    ) -> DataFusionResult<SendableSeriesStream>;
}
Expand description

A native operator that can hand its output over in-process without encoding a frame.

Implementing this is a statement about what the operator is: it runs in the same process as its consumer, and what it produces is an internal value rather than a message. A node that reads or writes a frame as its contract - a scan answering another process, an output boundary - must not implement it, and series_execution_plan is the one place a consumer asks.

[ExecutionPlan::execute] stays the whole answer for every consumer that is not native: an implementor still publishes its frames, packed from what it hands over here, so a plan with a foreign operator in the middle keeps working and is merely slower.

Required Methods§

Source

fn as_any(&self) -> &dyn Any

This plan as Any, so a plan reached through this trait can still be asked which concrete operator it is.

The obvious spelling of that question - downcast_ref::<dyn SeriesExecutionPlan>() on a &dyn Any - cannot be written, and not because of anything this trait does: [Any::downcast_ref] requires T: Sized and compares the type id of a concrete type, so a trait object is not a target it accepts. The standard answer is the one here: the trait exposes its object as dyn Any and the caller names the concrete type it wants, which is sized by construction. This is the same shape [ExecutionPlan] uses for its own downcasts, and it is a method on the trait rather than a where Self: Sized helper because it has to be callable on the trait object - the caller is a consumer holding &dyn SeriesExecutionPlan, which is exactly the value that is not sized.

Source

fn execute_series( &self, partition: usize, ctx: Arc<TaskContext>, ) -> DataFusionResult<SendableSeriesStream>

One partition’s output as internal series, not as a RecordBatch.

The stream carries each chunk with what it is charged to (HandedSeriesChunk), so nothing a producer reserved is released behind the consumer’s back: a consumer holds the reservation exactly as long as it holds the chunk.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§