TableVirtualUserIterator

Trait TableVirtualUserIterator 

Source
pub trait TableVirtualUserIterator: Send + 'static {
    // Required methods
    fn columns(&self) -> Vec<TableVirtualUserColumnDef>;
    fn initialize(
        &mut self,
        ctx: Option<&TableVirtualUserPushdownContext>,
    ) -> Result<()>;
    fn next_batch(
        &mut self,
        batch_size: usize,
    ) -> Result<Option<Vec<Vec<Value>>>>;
}
Expand description

Advanced trait for streaming virtual table implementations.

Implement this trait when your virtual table needs to:

  • Stream large datasets in batches
  • Take advantage of pushdown optimizations (limit, filters)

§Thread Safety

Unlike TableVirtualUser, implementations of this trait are instantiated fresh for each query. The factory creates a new instance per query execution.

Required Methods§

Source

fn columns(&self) -> Vec<TableVirtualUserColumnDef>

Return the column definitions for this table.

Source

fn initialize( &mut self, ctx: Option<&TableVirtualUserPushdownContext>, ) -> Result<()>

Initialize the iterator with optional pushdown context.

Called once before iteration begins. Use the pushdown context to optimize data generation (e.g., limit the number of rows fetched).

Source

fn next_batch(&mut self, batch_size: usize) -> Result<Option<Vec<Vec<Value>>>>

Get the next batch of rows.

Returns Ok(Some(rows)) with the next batch, or Ok(None) when exhausted. Each inner Vec<Value> represents one row.

The batch_size parameter is a hint for how many rows to return.

Implementors§