pub struct DataFrameReader { /* private fields */ }Expand description
DataFrameReader for reading various file formats Similar to PySpark’s DataFrameReader with option/options/format/load/table
Implementations§
Source§impl DataFrameReader
impl DataFrameReader
pub fn new(session: SparkSession) -> Self
Sourcepub fn option(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn option(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a single option (PySpark: option(key, value)). Returns self for chaining.
Sourcepub fn options(self, opts: impl IntoIterator<Item = (String, String)>) -> Self
pub fn options(self, opts: impl IntoIterator<Item = (String, String)>) -> Self
Add multiple options (PySpark: options(**kwargs)). Returns self for chaining.
Sourcepub fn format(self, fmt: impl Into<String>) -> Self
pub fn format(self, fmt: impl Into<String>) -> Self
Set the format for load() (PySpark: format(“parquet”) etc).
Sourcepub fn schema(self, _schema: impl Into<String>) -> Self
pub fn schema(self, _schema: impl Into<String>) -> Self
Set the schema (PySpark: schema(schema)). Stub: stores but does not apply yet.
Sourcepub fn load(&self, path: impl AsRef<Path>) -> Result<DataFrame, PolarsError>
pub fn load(&self, path: impl AsRef<Path>) -> Result<DataFrame, PolarsError>
Load data from path using format (or infer from extension) and options.
Sourcepub fn table(&self, name: &str) -> Result<DataFrame, PolarsError>
pub fn table(&self, name: &str) -> Result<DataFrame, PolarsError>
Return the named table/view (PySpark: table(name)).
pub fn csv(&self, path: impl AsRef<Path>) -> Result<DataFrame, PolarsError>
pub fn parquet(&self, path: impl AsRef<Path>) -> Result<DataFrame, PolarsError>
pub fn json(&self, path: impl AsRef<Path>) -> Result<DataFrame, PolarsError>
Auto Trait Implementations§
impl Freeze for DataFrameReader
impl RefUnwindSafe for DataFrameReader
impl Send for DataFrameReader
impl Sync for DataFrameReader
impl Unpin for DataFrameReader
impl UnsafeUnpin for DataFrameReader
impl UnwindSafe for DataFrameReader
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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