Skip to main content

DataSource

Trait DataSource 

Source
pub trait DataSource: Send {
    // Required methods
    fn schema(&self) -> SchemaRef;
    fn next_batch(&mut self) -> Result<Option<RecordBatch>>;

    // Provided methods
    fn size_hint(&self) -> Option<usize> { ... }
    fn reset(&mut self) -> Result<()> { ... }
}
Expand description

A data source that can produce RecordBatches on demand.

Required Methods§

Source

fn schema(&self) -> SchemaRef

Returns the schema of the data.

Source

fn next_batch(&mut self) -> Result<Option<RecordBatch>>

Returns the next batch of data, or None if exhausted.

§Errors

Returns an error if reading the next batch fails.

Provided Methods§

Source

fn size_hint(&self) -> Option<usize>

Returns an estimate of total rows, if known.

Source

fn reset(&mut self) -> Result<()>

Resets the source to the beginning, if supported.

§Errors

Returns an error if this data source does not support reset.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§