Skip to main content

ReaderBuilder

Struct ReaderBuilder 

Source
pub struct ReaderBuilder<R> {
    reader: R,
    file_size: u64,
    batch_size: usize,
    range: Option<Range<u64>>,
    reader_schema: Option<AvroSchema>,
    projection: Option<Vec<usize>>,
    header_size_hint: Option<u64>,
    utf8_view: bool,
    strict_mode: bool,
}
Expand description

Builder for an asynchronous Avro file reader.

Fields§

§reader: R§file_size: u64§batch_size: usize§range: Option<Range<u64>>§reader_schema: Option<AvroSchema>§projection: Option<Vec<usize>>§header_size_hint: Option<u64>§utf8_view: bool§strict_mode: bool

Implementations§

Source§

impl<R> ReaderBuilder<R>

Source

pub(super) fn new(reader: R, file_size: u64, batch_size: usize) -> Self

Source

pub fn with_range(self, range: Range<u64>) -> Self

Specify a byte range to read from the Avro file. If this is provided, the reader will read all the blocks within the specified range, if the range ends mid-block, it will attempt to fetch the remaining bytes to complete the block, but no further blocks will be read. If this is omitted, the full file will be read.

Source

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

Specify a reader schema to use when reading the Avro file. This can be useful to project specific columns or handle schema evolution. If this is not provided, the schema will be derived from the Arrow schema provided.

Source

pub fn with_projection(self, projection: Vec<usize>) -> Self

Specify a projection of column indices to read from the Avro file. This can help optimize reading by only fetching the necessary columns.

Source

pub fn with_header_size_hint(self, hint: u64) -> Self

Provide a hint for the expected size of the Avro header in bytes. This can help optimize the initial read operation when fetching the header.

Source

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

Enable usage of Utf8View types when reading string data.

Source

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

Enable strict mode for schema validation and data reading.

Source§

impl<R: AsyncFileReader> ReaderBuilder<R>

Source

async fn read_header(&mut self) -> Result<(Header, u64), AvroError>

Source

pub async fn try_build(self) -> Result<AsyncAvroFileReader<R>, AvroError>

Build the asynchronous Avro reader with the provided parameters. This reads the header first to initialize the reader state.

Auto Trait Implementations§

§

impl<R> Freeze for ReaderBuilder<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for ReaderBuilder<R>
where R: RefUnwindSafe,

§

impl<R> Send for ReaderBuilder<R>
where R: Send,

§

impl<R> Sync for ReaderBuilder<R>
where R: Sync,

§

impl<R> Unpin for ReaderBuilder<R>
where R: Unpin,

§

impl<R> UnwindSafe for ReaderBuilder<R>
where R: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
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,