Skip to main content

RowSource

Trait RowSource 

Source
pub trait RowSource: Send {
    // Required methods
    fn schema(&self) -> &[String];
    fn next_row(&mut self) -> ExecResult<Option<ResultRow>>;

    // Provided methods
    fn supports_batched_consumption(&self) -> bool { ... }
    fn physical_schema(&self) -> Option<&RowSchema> { ... }
    fn estimated_cardinality(&self) -> Option<u64> { ... }
    fn output_ordering(&self) -> &[PhysicalOrder] { ... }
    fn next_batch(&mut self, max_rows: usize) -> ExecResult<Vec<ResultRow>> { ... }
    fn next_physical_batch(
        &mut self,
        max_rows: usize,
    ) -> ExecResult<Vec<PhysicalRow>> { ... }
    fn consume_into_aggregate(
        &mut self,
        _executor: &mut dyn AggregateExecutor,
    ) -> ExecResult<bool> { ... }
    fn collect_materialized(
        &mut self,
        _sink: &mut MaterializedResultSink<'_>,
    ) -> ExecResult<bool> { ... }
}
Expand description

Source of rows feeding a TableScan. Implementors typically own a snapshot of the underlying table or external relation; the scan operator holds the source as a boxed trait object so callers can mix and match implementations across one query.

Required Methods§

Source

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

Stable column order for the rows produced by Self::next_row.

Source

fn next_row(&mut self) -> ExecResult<Option<ResultRow>>

Pull the next row. Returns None when the source is exhausted.

Provided Methods§

Source

fn supports_batched_consumption(&self) -> bool

Native batch reads preserve the SQL evaluation and first-error order of consecutive single-row reads when the caller consumes the complete input. Custom sources must establish this before opting in.

Source

fn physical_schema(&self) -> Option<&RowSchema>

Optional non-identity schema used by positional sources. This carries hidden lookup aliases and slot remaps that cannot be represented by the legacy column-name slice.

Source

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

Estimated total rows available from this source.

Source

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

Leading row order guaranteed by the source.

Source

fn next_batch(&mut self, max_rows: usize) -> ExecResult<Vec<ResultRow>>

Pull up to max_rows without forcing batch-capable sources through a row-at-a-time lock or backend call. The default preserves compatibility for iterator-like sources.

Source

fn next_physical_batch( &mut self, max_rows: usize, ) -> ExecResult<Vec<PhysicalRow>>

Pull a positional batch directly. Backend-native sources override this to avoid constructing named maps at the scan boundary; compatibility sources are converted exactly once here.

Source

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

Feed backend-native projected rows directly to an aggregate. Sources that cannot preserve their normal filter and virtual-column semantics return false without advancing their cursor.

Source

fn collect_materialized( &mut self, _sink: &mut MaterializedResultSink<'_>, ) -> ExecResult<bool>

Consume the complete source into the native public accumulator without transferring temporary row ownership. Unsupported sources decline before advancing their cursor.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§