TableVirtualUserIterator

Trait TableVirtualUserIterator 

Source
pub trait TableVirtualUserIterator:
    Send
    + Sync
    + 'static {
    // Required methods
    fn columns(&self) -> Vec<TableVirtualUserColumnDef>;
    fn initialize<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: Option<&'life1 TableVirtualUserPushdownContext>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn next_batch<'life0, 'async_trait>(
        &'life0 mut self,
        batch_size: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Vec<Value>>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
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<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: Option<&'life1 TableVirtualUserPushdownContext>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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<'life0, 'async_trait>( &'life0 mut self, batch_size: usize, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Vec<Value>>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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§