Skip to main content

WriterBuilder

Struct WriterBuilder 

Source
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

Source

pub fn new(schema: Schema) -> Self

Create a new builder with default settings.

The Avro schema used for writing is determined as follows:

  1. If the Arrow schema metadata contains avro::schema (see SCHEMA_METADATA_KEY), that JSON is used verbatim.
  2. Otherwise, the Arrow schema is converted to an Avro record schema.
Source

pub fn with_fingerprint_strategy(self, strategy: FingerprintStrategy) -> Self

Set the fingerprinting strategy for the stream writer. This determines the per-record prefix format.

Source

pub fn with_compression(self, codec: Option<CompressionCodec>) -> Self

Change the compression codec.

Source

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.

Source

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.

Source

fn prepare_encoder<F: AvroFormat>( &self, ) -> Result<(Arc<Schema>, RecordEncoder), AvroError>

Source

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.

Source

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

Source§

fn clone(&self) -> WriterBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WriterBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,