Skip to main content

RecordDeserializer

Trait RecordDeserializer 

Source
pub trait RecordDeserializer: Send + Sync {
    // Required methods
    fn deserialize(
        &self,
        data: &[u8],
        schema: &SchemaRef,
    ) -> Result<RecordBatch, SerdeError>;
    fn format(&self) -> Format;

    // Provided methods
    fn deserialize_batch(
        &self,
        records: &[&[u8]],
        schema: &SchemaRef,
    ) -> Result<RecordBatch, SerdeError> { ... }
    fn as_any_mut(&mut self) -> Option<&mut dyn Any> { ... }
}
Expand description

Trait for deserializing raw bytes into Arrow RecordBatch.

Implementations convert from external formats (JSON, CSV, Avro, etc.) into Arrow columnar format for processing.

Required Methods§

Source

fn deserialize( &self, data: &[u8], schema: &SchemaRef, ) -> Result<RecordBatch, SerdeError>

Deserializes a single record from raw bytes.

§Errors

Returns SerdeError if the input cannot be parsed or doesn’t match the expected schema.

Source

fn format(&self) -> Format

Returns the format this deserializer handles.

Provided Methods§

Source

fn deserialize_batch( &self, records: &[&[u8]], schema: &SchemaRef, ) -> Result<RecordBatch, SerdeError>

Deserializes a batch of records from raw bytes.

The default implementation calls deserialize for each record and concatenates the results. Implementations should override this for better performance with batch-oriented formats.

§Errors

Returns SerdeError if any record cannot be parsed.

Source

fn as_any_mut(&mut self) -> Option<&mut dyn Any>

Downcasts to concrete type (e.g., for Avro schema resolution).

Implementors§