Skip to main content

FormatDecoder

Trait FormatDecoder 

Source
pub trait FormatDecoder: Send + Sync {
    // Required methods
    fn output_schema(&self) -> SchemaRef;
    fn decode_batch(&self, records: &[RawRecord]) -> SchemaResult<RecordBatch>;
    fn format_name(&self) -> &str;

    // Provided method
    fn decode_one(&self, record: &RawRecord) -> SchemaResult<RecordBatch> { ... }
}
Expand description

Decodes raw bytes into Arrow RecordBatches.

Unlike RecordDeserializer which takes &[u8] slices, FormatDecoder works with RawRecords that carry metadata, headers, and timestamps alongside the payload.

Required Methods§

Source

fn output_schema(&self) -> SchemaRef

Returns the Arrow schema produced by this decoder.

Source

fn decode_batch(&self, records: &[RawRecord]) -> SchemaResult<RecordBatch>

Decodes a batch of raw records into an Arrow RecordBatch.

§Errors

Returns SchemaError::DecodeError if the input cannot be parsed.

Source

fn format_name(&self) -> &str

Returns the name of the format this decoder handles (e.g., "json").

Provided Methods§

Source

fn decode_one(&self, record: &RawRecord) -> SchemaResult<RecordBatch>

Decodes a single raw record into an Arrow RecordBatch with one row.

Default implementation delegates to decode_batch with a single-element slice.

§Errors

Returns SchemaError::DecodeError if the input cannot be parsed.

Implementors§