pub struct DataFrameReader { /* private fields */ }
Expand description
DataFrameReader represents the entrypoint to create a DataFrame from a specific file format.
Implementations§
Source§impl DataFrameReader
impl DataFrameReader
Sourcepub fn new(spark_session: SparkSession) -> Self
pub fn new(spark_session: SparkSession) -> Self
Create a new DataFrameReader with a SparkSession
Sourcepub fn option(self, key: &str, value: &str) -> Self
pub fn option(self, key: &str, value: &str) -> Self
Add an input option for the underlying data source
pub fn schema<T: ToSchema>(self, schema: T) -> Self
Sourcepub fn options<I, K, V>(self, options: I) -> Self
pub fn options<I, K, V>(self, options: I) -> Self
Set many input options based on an iterator of (key/value pairs) for the underlying data source
Sourcepub fn load<'a, I>(self, paths: I) -> Result<DataFrame, SparkError>where
I: IntoIterator<Item = &'a str>,
pub fn load<'a, I>(self, paths: I) -> Result<DataFrame, SparkError>where
I: IntoIterator<Item = &'a str>,
Loads data from a data source and returns it as a DataFrame
Example:
let path = vec!["some/dir/path/on/the/remote/cluster/"];
// returns a DataFrame from a csv file with a header from a the specific path
let mut df = spark.read().format("csv").option("header", "true").load(path);
Trait Implementations§
Source§impl Clone for DataFrameReader
impl Clone for DataFrameReader
Source§fn clone(&self) -> DataFrameReader
fn clone(&self) -> DataFrameReader
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for DataFrameReader
impl !RefUnwindSafe for DataFrameReader
impl Send for DataFrameReader
impl Sync for DataFrameReader
impl Unpin 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request