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§
Sourcefn output_schema(&self) -> SchemaRef
fn output_schema(&self) -> SchemaRef
Returns the Arrow schema produced by this decoder.
Sourcefn decode_batch(&self, records: &[RawRecord]) -> SchemaResult<RecordBatch>
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.
Sourcefn format_name(&self) -> &str
fn format_name(&self) -> &str
Returns the name of the format this decoder handles (e.g., "json").
Provided Methods§
Sourcefn decode_one(&self, record: &RawRecord) -> SchemaResult<RecordBatch>
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.