Skip to main content

PhysicalOperator

Trait PhysicalOperator 

Source
pub trait PhysicalOperator: Send {
    // Required methods
    fn row_schema(&self) -> &RowSchema;
    fn open(&mut self) -> ExecResult<()>;
    fn next(&mut self) -> ExecResult<Option<Batch>>;
    fn close(&mut self) -> ExecResult<()>;

    // Provided methods
    fn schema(&self) -> &[String] { ... }
    fn estimated_cardinality(&self) -> Option<u64> { ... }
    fn output_ordering(&self) -> &[PhysicalOrder] { ... }
    fn consume_into_aggregate(
        &mut self,
        _executor: &mut dyn AggregateExecutor,
    ) -> ExecResult<bool> { ... }
}
Expand description

Volcano-style streaming operator. Operators form a tree; each operator pulls from its children inside next and emits a Batch until the input is exhausted.

Pipeline lifecycle:

  1. open – bind state, open child operators, allocate buffers.
  2. next – pull the next Batch; return None to terminate.
  3. close – release buffers and close child operators.

Blocking operators (sort / hash-aggregate) materialise their input during open; pipelined operators (filter / project / limit) emit batches as they arrive.

Required Methods§

Source

fn row_schema(&self) -> &RowSchema

Complete logical-to-physical row layout emitted by this operator. Every Batch returned by Self::next must carry this exact schema; operators must reject a child that violates that invariant.

Source

fn open(&mut self) -> ExecResult<()>

Source

fn next(&mut self) -> ExecResult<Option<Batch>>

Source

fn close(&mut self) -> ExecResult<()>

Provided Methods§

Source

fn schema(&self) -> &[String]

Schema column names in logical output order.

Source

fn estimated_cardinality(&self) -> Option<u64>

Planner/runtime cardinality estimate for choosing physical strategies. None means the operator cannot provide a useful estimate. The value is advisory rather than a correctness bound.

Source

fn output_ordering(&self) -> &[PhysicalOrder]

Leading output ordering known to be preserved by this operator.

Source

fn consume_into_aggregate( &mut self, _executor: &mut dyn AggregateExecutor, ) -> ExecResult<bool>

Let a leaf consume its native projected rows directly into an aggregate executor. Returning false promises that no input was consumed, so the caller can fall back to ordinary Batch pulls.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§