Skip to main content

RecordSerializer

Trait RecordSerializer 

Source
pub trait RecordSerializer: Send + Sync {
    // Required methods
    fn serialize(&self, batch: &RecordBatch) -> Result<Vec<Vec<u8>>, SerdeError>;
    fn format(&self) -> Format;

    // Provided method
    fn serialize_batch(
        &self,
        batch: &RecordBatch,
    ) -> Result<Vec<u8>, SerdeError> { ... }
}
Expand description

Trait for serializing Arrow RecordBatch into raw bytes.

Implementations convert from Arrow columnar format to external formats for writing to sinks.

Required Methods§

Source

fn serialize(&self, batch: &RecordBatch) -> Result<Vec<Vec<u8>>, SerdeError>

Serializes a RecordBatch into a vector of byte records.

Each element in the returned vector represents one serialized record.

§Errors

Returns SerdeError if serialization fails.

Source

fn format(&self) -> Format

Returns the format this serializer produces.

Provided Methods§

Source

fn serialize_batch(&self, batch: &RecordBatch) -> Result<Vec<u8>, SerdeError>

Serializes a RecordBatch into a single byte buffer.

For formats that support batch encoding (e.g., JSON array, CSV), this may be more efficient than serializing individual records.

§Errors

Returns SerdeError if serialization fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§