Struct polars_io::avro::AvroReader
source · [−]pub struct AvroReader<R> { /* private fields */ }
Available on crate feature
avro
only.Expand description
Read Apache Avro format into a DataFrame
Example
use std::fs::File;
use polars_core::prelude::*;
use polars_io::avro::AvroReader;
use polars_io::SerReader;
fn example() -> Result<DataFrame> {
let file = File::open("file.avro").expect("file not found");
AvroReader::new(file)
.finish()
}
Implementations
sourceimpl<R: Read + Seek> AvroReader<R>
impl<R: Read + Seek> AvroReader<R>
sourcepub fn arrow_schema(&mut self) -> Result<ArrowSchema>
pub fn arrow_schema(&mut self) -> Result<ArrowSchema>
Get arrow schema of the avro File, this is faster than a polars schema.
sourcepub fn with_n_rows(self, num_rows: Option<usize>) -> Self
pub fn with_n_rows(self, num_rows: Option<usize>) -> Self
Stop reading when n
rows are read.
sourcepub fn with_projection(self, projection: Option<Vec<usize>>) -> Self
pub fn with_projection(self, projection: Option<Vec<usize>>) -> Self
Set the reader’s column projection. This counts from 0, meaning that
vec![0, 4]
would select the 1st and 5th column.
sourcepub fn with_columns(self, columns: Option<Vec<String>>) -> Self
pub fn with_columns(self, columns: Option<Vec<String>>) -> Self
Columns to select/ project
Trait Implementations
Auto Trait Implementations
impl<R> RefUnwindSafe for AvroReader<R> where
R: RefUnwindSafe,
impl<R> Send for AvroReader<R> where
R: Send,
impl<R> Sync for AvroReader<R> where
R: Sync,
impl<R> Unpin for AvroReader<R> where
R: Unpin,
impl<R> UnwindSafe for AvroReader<R> where
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more