pub struct ParquetReader<R>{ /* private fields */ }
Available on crate feature
polars-io
only.Expand description
Read Apache parquet format into a DataFrame.
Implementations§
Source§impl<R> ParquetReader<R>where
R: MmapBytesReader,
impl<R> ParquetReader<R>where
R: MmapBytesReader,
Sourcepub fn set_low_memory(self, low_memory: bool) -> ParquetReader<R>
pub fn set_low_memory(self, low_memory: bool) -> ParquetReader<R>
Try to reduce memory pressure at the expense of performance. If setting this does not reduce memory enough, turn off parallelization.
Sourcepub fn read_parallel(self, parallel: ParallelStrategy) -> ParquetReader<R>
pub fn read_parallel(self, parallel: ParallelStrategy) -> ParquetReader<R>
Read the parquet file in parallel (default). The single threaded reader consumes less memory.
pub fn with_slice(self, slice: Option<(usize, usize)>) -> ParquetReader<R>
Sourcepub fn with_columns(self, columns: Option<Vec<String>>) -> ParquetReader<R>
pub fn with_columns(self, columns: Option<Vec<String>>) -> ParquetReader<R>
Columns to select/ project
Sourcepub fn with_projection(self, projection: Option<Vec<usize>>) -> ParquetReader<R>
pub fn with_projection(self, projection: Option<Vec<usize>>) -> ParquetReader<R>
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_row_index(self, row_index: Option<RowIndex>) -> ParquetReader<R>
pub fn with_row_index(self, row_index: Option<RowIndex>) -> ParquetReader<R>
Add a row index column.
Sourcepub fn with_arrow_schema_projection(
self,
first_schema: &Arc<Schema<Field>>,
projected_arrow_schema: Option<&Schema<Field>>,
allow_missing_columns: bool,
) -> Result<ParquetReader<R>, PolarsError>
pub fn with_arrow_schema_projection( self, first_schema: &Arc<Schema<Field>>, projected_arrow_schema: Option<&Schema<Field>>, allow_missing_columns: bool, ) -> Result<ParquetReader<R>, PolarsError>
Checks that the file contains all the columns in projected_arrow_schema
with the same
dtype, and sets the projection indices.
Sourcepub fn use_statistics(self, toggle: bool) -> ParquetReader<R>
pub fn use_statistics(self, toggle: bool) -> ParquetReader<R>
Use statistics in the parquet to determine if pages can be skipped from reading.
Sourcepub fn num_rows(&mut self) -> Result<usize, PolarsError>
pub fn num_rows(&mut self) -> Result<usize, PolarsError>
Number of rows in the parquet file.
pub fn with_hive_partition_columns( self, columns: Option<Vec<Series>>, ) -> ParquetReader<R>
pub fn with_include_file_path( self, include_file_path: Option<(PlSmallStr, Arc<str>)>, ) -> ParquetReader<R>
pub fn set_metadata(&mut self, metadata: Arc<FileMetadata>)
pub fn get_metadata(&mut self) -> Result<&Arc<FileMetadata>, PolarsError>
pub fn with_predicate( self, predicate: Option<Arc<dyn PhysicalIoExpr>>, ) -> ParquetReader<R>
Source§impl<R> ParquetReader<R>where
R: MmapBytesReader + 'static,
impl<R> ParquetReader<R>where
R: MmapBytesReader + 'static,
pub fn batched( self, chunk_size: usize, ) -> Result<BatchedParquetReader, PolarsError>
Trait Implementations§
Source§impl<R> SerReader<R> for ParquetReader<R>where
R: MmapBytesReader,
impl<R> SerReader<R> for ParquetReader<R>where
R: MmapBytesReader,
Source§fn new(reader: R) -> ParquetReader<R>
fn new(reader: R) -> ParquetReader<R>
Create a new ParquetReader
from an existing Reader
.
Source§fn set_rechunk(self, rechunk: bool) -> ParquetReader<R>
fn set_rechunk(self, rechunk: bool) -> ParquetReader<R>
Make sure that all columns are contiguous in memory by
aggregating the chunks into a single array.
Auto Trait Implementations§
impl<R> Freeze for ParquetReader<R>where
R: Freeze,
impl<R> !RefUnwindSafe for ParquetReader<R>
impl<R> Send for ParquetReader<R>where
R: Send,
impl<R> Sync for ParquetReader<R>where
R: Sync,
impl<R> Unpin for ParquetReader<R>where
R: Unpin,
impl<R> !UnwindSafe for ParquetReader<R>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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