pub struct SparkSession { /* private fields */ }
Expand description
The entry point to connecting to a Spark Cluster using the Spark Connection gRPC protocol.
Implementations§
Source§impl SparkSession
impl SparkSession
pub fn new( client: SparkConnectClient<InterceptedService<Channel, MetadataInterceptor>>, ) -> Self
pub fn session(&self) -> SparkSession
Sourcepub fn range(
&self,
start: Option<i64>,
end: i64,
step: i64,
num_partitions: Option<i32>,
) -> DataFrame
pub fn range( &self, start: Option<i64>, end: i64, step: i64, num_partitions: Option<i32>, ) -> DataFrame
Create a DataFrame with a spingle column named id
,
containing elements in a range from start
(default 0) to
end
(exclusive) with a step value step
, and control the number
of partitions with num_partitions
Sourcepub fn read(&self) -> DataFrameReader
pub fn read(&self) -> DataFrameReader
Returns a DataFrameReader that can be used to read datra in as a DataFrame
Sourcepub fn read_stream(&self) -> DataStreamReader
pub fn read_stream(&self) -> DataStreamReader
Returns a DataFrameReader that can be used to read datra in as a DataFrame
pub fn table(&self, name: &str) -> Result<DataFrame, SparkError>
Sourcepub fn catalog(&self) -> Catalog
pub fn catalog(&self) -> Catalog
Interface through which the user may create, drop, alter or query underlying databases, tables, functions, etc.
Sourcepub async fn sql(&self, sql_query: &str) -> Result<DataFrame, SparkError>
pub async fn sql(&self, sql_query: &str) -> Result<DataFrame, SparkError>
Returns a DataFrame representing the result of the given query
pub fn create_dataframe( &self, data: &RecordBatch, ) -> Result<DataFrame, SparkError>
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Return the session ID
Sourcepub fn client(
self,
) -> SparkConnectClient<InterceptedService<Channel, MetadataInterceptor>>
pub fn client( self, ) -> SparkConnectClient<InterceptedService<Channel, MetadataInterceptor>>
Spark Connection gRPC client interface
Sourcepub async fn interrupt_all(&self) -> Result<Vec<String>, SparkError>
pub async fn interrupt_all(&self) -> Result<Vec<String>, SparkError>
Interrupt all operations of this session currently running on the connected server.
Sourcepub async fn interrupt_tag(&self, tag: &str) -> Result<Vec<String>, SparkError>
pub async fn interrupt_tag(&self, tag: &str) -> Result<Vec<String>, SparkError>
Interrupt all operations of this session with the given operation tag.
Sourcepub async fn interrupt_operation(
&self,
op_id: &str,
) -> Result<Vec<String>, SparkError>
pub async fn interrupt_operation( &self, op_id: &str, ) -> Result<Vec<String>, SparkError>
Interrupt an operation of this session with the given operationId.
Sourcepub fn add_tag(&mut self, tag: &str) -> Result<(), SparkError>
pub fn add_tag(&mut self, tag: &str) -> Result<(), SparkError>
Add a tag to be assigned to all the operations started by this thread in this session.
Sourcepub fn remove_tag(&mut self, tag: &str) -> Result<(), SparkError>
pub fn remove_tag(&mut self, tag: &str) -> Result<(), SparkError>
Remove a tag previously added to be assigned to all the operations started by this thread in this session.
Get the tags that are currently set to be assigned to all the operations started by this thread.
Clear the current thread’s operation tags.
Sourcepub async fn version(&self) -> Result<String, SparkError>
pub async fn version(&self) -> Result<String, SparkError>
The version of Spark on which this application is running.
Sourcepub fn conf(&self) -> RunTimeConfig
pub fn conf(&self) -> RunTimeConfig
RunTimeConfig configuration interface for Spark.
Trait Implementations§
Source§impl Clone for SparkSession
impl Clone for SparkSession
Source§fn clone(&self) -> SparkSession
fn clone(&self) -> SparkSession
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for SparkSession
impl !RefUnwindSafe for SparkSession
impl Send for SparkSession
impl Sync for SparkSession
impl Unpin for SparkSession
impl !UnwindSafe for SparkSession
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
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>
T
in a tonic::Request