ReaderBuilder

Struct ReaderBuilder 

Source
pub struct ReaderBuilder {
    batch_size: usize,
    strict_mode: bool,
    utf8_view: bool,
    reader_schema: Option<AvroSchema>,
    writer_schema_store: Option<SchemaStore>,
    active_fingerprint: Option<Fingerprint>,
}
Expand description

A builder to create an Avro Reader that reads Avro data into Arrow RecordBatch.

Fields§

§batch_size: usize§strict_mode: bool§utf8_view: bool§reader_schema: Option<AvroSchema>§writer_schema_store: Option<SchemaStore>§active_fingerprint: Option<Fingerprint>

Implementations§

Source§

impl ReaderBuilder

Source

pub fn new() -> Self

Creates a new ReaderBuilder with default settings:

  • batch_size = 1024
  • strict_mode = false
  • utf8_view = false
  • reader_schema = None
  • writer_schema_store = None
  • active_fingerprint = None
Source

fn make_record_decoder( &self, writer_schema: &Schema<'_>, reader_schema: Option<&Schema<'_>>, ) -> Result<RecordDecoder, ArrowError>

Source

fn make_record_decoder_from_schemas( &self, writer_schema: &Schema<'_>, reader_schema: Option<&AvroSchema>, ) -> Result<RecordDecoder, ArrowError>

Source

fn make_decoder_with_parts( &self, active_decoder: RecordDecoder, active_fingerprint: Option<Fingerprint>, cache: IndexMap<Fingerprint, RecordDecoder>, fingerprint_algorithm: FingerprintAlgorithm, ) -> Decoder

Source

fn make_decoder( &self, header: Option<&Header>, reader_schema: Option<&AvroSchema>, ) -> Result<Decoder, ArrowError>

Source

pub fn with_batch_size(self, batch_size: usize) -> Self

Sets the row-based batch size

Source

pub fn with_utf8_view(self, utf8_view: bool) -> Self

Set whether to use StringViewArray for string data

When enabled, string data from Avro files will be loaded into Arrow’s StringViewArray instead of the standard StringArray.

Source

pub fn use_utf8view(&self) -> bool

Get whether StringViewArray is enabled for string data

Source

pub fn with_strict_mode(self, strict_mode: bool) -> Self

Controls whether certain Avro unions of the form [T, "null"] should produce an error.

Source

pub fn with_reader_schema(self, schema: AvroSchema) -> Self

Sets the Avro reader schema.

If a schema is not provided, the schema will be read from the Avro file header.

Source

pub fn with_writer_schema_store(self, store: SchemaStore) -> Self

Sets the SchemaStore used for resolving writer schemas.

This is necessary when decoding single-object encoded data that identifies schemas by a fingerprint. The store allows the decoder to look up the full writer schema from a fingerprint embedded in the data.

Defaults to None.

Source

pub fn with_active_fingerprint(self, fp: Fingerprint) -> Self

Sets the initial schema fingerprint for decoding single-object encoded data.

This is useful when the data stream does not begin with a schema definition or fingerprint, allowing the decoder to start with a known schema from the SchemaStore.

Defaults to None.

Source

pub fn build<R: BufRead>(self, reader: R) -> Result<Reader<R>, ArrowError>

Create a Reader from this builder and a BufRead

Source

pub fn build_decoder(self) -> Result<Decoder, ArrowError>

Create a Decoder from this builder.

Trait Implementations§

Source§

impl Debug for ReaderBuilder

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ReaderBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, 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,