pub struct IpcReader<R: MmapBytesReader> { /* private fields */ }Available on (crate features
ipc or ipc_streaming) and crate feature ipc only.Expand description
Read Arrows IPC format into a DataFrame
§Example
use polars_core::prelude::*;
use std::fs::File;
use polars_io::ipc::IpcReader;
use polars_io::SerReader;
fn example() -> PolarsResult<DataFrame> {
let file = File::open("file.ipc").expect("file not found");
IpcReader::new(file)
.finish()
}Implementations§
Source§impl<R: MmapBytesReader> IpcReader<R>
impl<R: MmapBytesReader> IpcReader<R>
Sourcepub fn custom_metadata(&mut self) -> PolarsResult<Option<Arc<Metadata>>>
pub fn custom_metadata(&mut self) -> PolarsResult<Option<Arc<Metadata>>>
Get schema-level custom metadata of the Ipc file
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_columns(self, columns: Option<Vec<String>>) -> Self
pub fn with_columns(self, columns: Option<Vec<String>>) -> Self
Columns to select/ project
pub fn with_hive_partition_columns(self, columns: Option<Vec<Series>>) -> Self
pub fn with_include_file_path( self, include_file_path: Option<(PlSmallStr, PlRefStr)>, ) -> Self
Sourcepub fn with_row_index(self, row_index: Option<RowIndex>) -> Self
pub fn with_row_index(self, row_index: Option<RowIndex>) -> Self
Add a row index column.
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 unsafe fn memory_mapped(self, path_buf: Option<PathBuf>) -> Self
pub unsafe fn memory_mapped(self, path_buf: Option<PathBuf>) -> Self
Set if the file is to be memory_mapped. Only works with uncompressed files. The file name must be passed to register the memory mapped file.
§Safety
The users guarantees that the arrow data in the given path is valid and remains valid throughout memory mapping.
pub fn finish_with_scan_ops( self, predicate: Option<Arc<dyn PhysicalIoExpr>>, verbose: bool, ) -> PolarsResult<DataFrame>
Available on crate feature
lazy only.Trait Implementations§
Source§impl<R: MmapBytesReader> SerReader<R> for IpcReader<R>
impl<R: MmapBytesReader> SerReader<R> for IpcReader<R>
Source§fn set_rechunk(self, rechunk: bool) -> Self
fn set_rechunk(self, rechunk: bool) -> Self
Make sure that all columns are contiguous in memory by
aggregating the chunks into a single array.
Auto Trait Implementations§
impl<R> Freeze for IpcReader<R>where
R: Freeze,
impl<R> !RefUnwindSafe for IpcReader<R>
impl<R> Send for IpcReader<R>
impl<R> Sync for IpcReader<R>
impl<R> Unpin for IpcReader<R>where
R: Unpin,
impl<R> UnsafeUnpin for IpcReader<R>where
R: UnsafeUnpin,
impl<R> !UnwindSafe for IpcReader<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