pub struct ReaderBuilder { /* private fields */ }Expand description
Avro file reader builder
Implementations§
Source§impl ReaderBuilder
impl ReaderBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new builder for configuring Avro parsing options.
To convert a builder into a reader, call Reader::from_builder
§Example
use std::fs::File;
use datafusion_datasource_avro::avro_to_arrow::{Reader, ReaderBuilder};
fn example() -> Reader<'static, File> {
let file = File::open("test/data/basic.avro").unwrap();
// create a builder, inferring the schema with the first 100 records
let builder = ReaderBuilder::new().read_schema().with_batch_size(100);
let reader = builder.build::<File>(file).unwrap();
reader
}Sourcepub fn with_schema(self, schema: SchemaRef) -> Self
pub fn with_schema(self, schema: SchemaRef) -> Self
Set the Avro file’s schema
Sourcepub fn read_schema(self) -> Self
pub fn read_schema(self) -> Self
Set the Avro reader to infer the schema of the file
Sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Set the batch size (number of records to load at one time)
Sourcepub fn with_projection(self, projection: Vec<String>) -> Self
pub fn with_projection(self, projection: Vec<String>) -> Self
Set the reader’s column projection
Trait Implementations§
Source§impl Debug for ReaderBuilder
impl Debug for ReaderBuilder
Auto Trait Implementations§
impl Freeze for ReaderBuilder
impl RefUnwindSafe for ReaderBuilder
impl Send for ReaderBuilder
impl Sync for ReaderBuilder
impl Unpin for ReaderBuilder
impl UnsafeUnpin for ReaderBuilder
impl UnwindSafe for ReaderBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more