pub struct WriterBuilder {
schema: Schema,
codec: Option<CompressionCodec>,
row_capacity: Option<usize>,
capacity: usize,
fingerprint_strategy: Option<FingerprintStrategy>,
}Expand description
Builder to configure and create a Writer.
Fields§
§schema: Schema§codec: Option<CompressionCodec>§row_capacity: Option<usize>§capacity: usize§fingerprint_strategy: Option<FingerprintStrategy>Implementations§
Source§impl WriterBuilder
impl WriterBuilder
Sourcepub fn new(schema: Schema) -> Self
pub fn new(schema: Schema) -> Self
Create a new builder with default settings.
The Avro schema used for writing is determined as follows:
- If the Arrow schema metadata contains
avro::schema(seeSCHEMA_METADATA_KEY), that JSON is used verbatim. - Otherwise, the Arrow schema is converted to an Avro record schema.
Sourcepub fn with_fingerprint_strategy(self, strategy: FingerprintStrategy) -> Self
pub fn with_fingerprint_strategy(self, strategy: FingerprintStrategy) -> Self
Set the fingerprinting strategy for the stream writer. This determines the per-record prefix format.
Sourcepub fn with_compression(self, codec: Option<CompressionCodec>) -> Self
pub fn with_compression(self, codec: Option<CompressionCodec>) -> Self
Change the compression codec.
Sourcepub fn with_capacity(self, capacity: usize) -> Self
pub fn with_capacity(self, capacity: usize) -> Self
Sets the expected capacity (in bytes) for internal buffers.
This is used as a hint to pre-allocate staging buffers for writing.
Sourcepub fn with_row_capacity(self, capacity: usize) -> Self
pub fn with_row_capacity(self, capacity: usize) -> Self
Sets the expected byte size for each encoded row.
This setting affects Encoder created via build_encoder.
It is used as a hint to reduce reallocations when the typical encoded row size is known.
fn prepare_encoder<F: AvroFormat>( &self, ) -> Result<(Arc<Schema>, RecordEncoder), AvroError>
Sourcepub fn build_encoder<F: AvroFormat>(self) -> Result<Encoder, AvroError>
pub fn build_encoder<F: AvroFormat>(self) -> Result<Encoder, AvroError>
Build a new Encoder for the given AvroFormat.
Encoder only supports stream formats (no OCF sync markers). Attempting to build an
encoder with an OCF format (e.g. AvroOcfFormat) will return an error.
Sourcepub fn build<W, F>(self, writer: W) -> Result<Writer<W, F>, AvroError>where
W: Write,
F: AvroFormat,
pub fn build<W, F>(self, writer: W) -> Result<Writer<W, F>, AvroError>where
W: Write,
F: AvroFormat,
Build a new Writer with the specified AvroFormat and builder options.
Trait Implementations§
Source§impl Clone for WriterBuilder
impl Clone for WriterBuilder
Source§fn clone(&self) -> WriterBuilder
fn clone(&self) -> WriterBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more