common_datasource::file_format

Trait ArrowDecoder

source
pub trait ArrowDecoder: Send + 'static {
    // Required methods
    fn decode(&mut self, buf: &[u8]) -> Result<usize, ArrowError>;
    fn flush(&mut self) -> Result<Option<RecordBatch>, ArrowError>;
}

Required Methods§

source

fn decode(&mut self, buf: &[u8]) -> Result<usize, ArrowError>

Decode records from buf returning the number of bytes read.

This method returns Ok(0) once batch_size objects have been parsed since the last call to Self::flush, or buf is exhausted.

Any remaining bytes should be included in the next call to Self::decode.

source

fn flush(&mut self) -> Result<Option<RecordBatch>, ArrowError>

Flushes the currently buffered data to a [RecordBatch].

This should only be called after Self::decode has returned Ok(0), otherwise may return an error if part way through decoding a record

Returns Ok(None) if no buffered data.

Implementations on Foreign Types§

source§

impl ArrowDecoder for Decoder

source§

fn decode(&mut self, buf: &[u8]) -> Result<usize, ArrowError>

source§

fn flush(&mut self) -> Result<Option<RecordBatch>, ArrowError>

Implementors§