StreamProvider

Trait StreamProvider 

Source
pub trait StreamProvider:
    Debug
    + Send
    + Sync {
    // Required methods
    fn schema(&self) -> &Arc<Schema>;
    fn reader(
        &self,
    ) -> Result<Box<dyn RecordBatchReader<Item = Result<RecordBatch, ArrowError>>>, DataFusionError>;
    fn stream_write_display(
        &self,
        t: DisplayFormatType,
        f: &mut Formatter<'_>,
    ) -> Result<(), Error>;

    // Provided method
    fn writer(&self) -> Result<Box<dyn RecordBatchWriter>, DataFusionError> { ... }
}
Expand description

The StreamProvider trait is used as a generic interface for reading and writing from streaming data sources (such as FIFO, Websocket, Kafka, etc.). Implementations of the provider are responsible for providing a RecordBatchReader and optionally a RecordBatchWriter.

Required Methods§

Source

fn schema(&self) -> &Arc<Schema>

Get a reference to the schema for this stream

Source

fn reader( &self, ) -> Result<Box<dyn RecordBatchReader<Item = Result<RecordBatch, ArrowError>>>, DataFusionError>

Provide RecordBatchReader

Source

fn stream_write_display( &self, t: DisplayFormatType, f: &mut Formatter<'_>, ) -> Result<(), Error>

Display implementation when using as a DataSink

Provided Methods§

Source

fn writer(&self) -> Result<Box<dyn RecordBatchWriter>, DataFusionError>

Provide RecordBatchWriter

Implementors§