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§
Sourcefn deserialize(
&self,
data: &[u8],
schema: &SchemaRef,
) -> Result<RecordBatch, SerdeError>
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.
Provided Methods§
Sourcefn deserialize_batch(
&self,
records: &[&[u8]],
schema: &SchemaRef,
) -> Result<RecordBatch, SerdeError>
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.
Sourcefn as_any_mut(&mut self) -> Option<&mut dyn Any>
fn as_any_mut(&mut self) -> Option<&mut dyn Any>
Downcasts to concrete type (e.g., for Avro schema resolution).