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
impl ReaderBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ReaderBuilder
with default settings:
batch_size
= 1024strict_mode
= falseutf8_view
= falsereader_schema
= Nonewriter_schema_store
= Noneactive_fingerprint
= None
fn make_record_decoder( &self, writer_schema: &Schema<'_>, reader_schema: Option<&Schema<'_>>, ) -> Result<RecordDecoder, ArrowError>
fn make_record_decoder_from_schemas( &self, writer_schema: &Schema<'_>, reader_schema: Option<&AvroSchema>, ) -> Result<RecordDecoder, ArrowError>
fn make_decoder_with_parts( &self, active_decoder: RecordDecoder, active_fingerprint: Option<Fingerprint>, cache: IndexMap<Fingerprint, RecordDecoder>, fingerprint_algorithm: FingerprintAlgorithm, ) -> Decoder
fn make_decoder( &self, header: Option<&Header>, reader_schema: Option<&AvroSchema>, ) -> Result<Decoder, ArrowError>
Sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Sets the row-based batch size
Sourcepub fn with_utf8_view(self, utf8_view: bool) -> Self
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.
Sourcepub fn use_utf8view(&self) -> bool
pub fn use_utf8view(&self) -> bool
Get whether StringViewArray is enabled for string data
Sourcepub fn with_strict_mode(self, strict_mode: bool) -> Self
pub fn with_strict_mode(self, strict_mode: bool) -> Self
Controls whether certain Avro unions of the form [T, "null"]
should produce an error.
Sourcepub fn with_reader_schema(self, schema: AvroSchema) -> Self
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.
Sourcepub fn with_writer_schema_store(self, store: SchemaStore) -> Self
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
.
Sourcepub fn with_active_fingerprint(self, fp: Fingerprint) -> Self
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
.
Sourcepub fn build<R: BufRead>(self, reader: R) -> Result<Reader<R>, ArrowError>
pub fn build<R: BufRead>(self, reader: R) -> Result<Reader<R>, ArrowError>
Create a Reader
from this builder and a BufRead
Sourcepub fn build_decoder(self) -> Result<Decoder, ArrowError>
pub fn build_decoder(self) -> Result<Decoder, ArrowError>
Create a Decoder
from this builder.