Struct spark_connect_rs::dataframe::StreamingQuery
source · pub struct StreamingQuery { /* private fields */ }
Expand description
Represents the active streaming created from a start
on the writer
This object is used to control and monitor the active stream
Implementations§
source§impl StreamingQuery
impl StreamingQuery
pub fn new( spark_session: Box<SparkSession>, write_stream: WriteStreamOperationStartResult ) -> StreamingQuery
pub fn id(&self) -> String
pub fn run_id(&self) -> String
pub fn name(&self) -> Option<String>
pub async fn awaitTermination( self, timeout_ms: Option<i64> ) -> Result<bool, SparkError>
sourcepub async fn lastProgress(self) -> Result<Value, SparkError>
pub async fn lastProgress(self) -> Result<Value, SparkError>
Examples found in repository?
examples/readstream.rs (line 34)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let spark: SparkSession =
SparkSessionBuilder::remote("sc://127.0.0.1:15002/;user_id=stream_example")
.build()
.await?;
let df = spark
.readStream()
.format("rate")
.option("rowsPerSecond", "5")
.load(None)?;
let query = df
.writeStream()
.format("console")
.queryName("example_stream")
.outputMode(OutputMode::Append)
.trigger(Trigger::ProcessingTimeInterval("1 seconds".to_string()))
.start(None)
.await?;
// loop to get multiple progression stats
for _ in 1..5 {
thread::sleep(time::Duration::from_secs(5));
let val = &query.clone().lastProgress().await?;
println!("{}", val);
}
// stop the active stream
query.stop().await?;
Ok(())
}
pub async fn recentProgress(self) -> Result<Value, SparkError>
pub async fn isActive(self) -> Result<bool, SparkError>
sourcepub async fn stop(self) -> Result<bool, SparkError>
pub async fn stop(self) -> Result<bool, SparkError>
Examples found in repository?
examples/readstream.rs (line 39)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let spark: SparkSession =
SparkSessionBuilder::remote("sc://127.0.0.1:15002/;user_id=stream_example")
.build()
.await?;
let df = spark
.readStream()
.format("rate")
.option("rowsPerSecond", "5")
.load(None)?;
let query = df
.writeStream()
.format("console")
.queryName("example_stream")
.outputMode(OutputMode::Append)
.trigger(Trigger::ProcessingTimeInterval("1 seconds".to_string()))
.start(None)
.await?;
// loop to get multiple progression stats
for _ in 1..5 {
thread::sleep(time::Duration::from_secs(5));
let val = &query.clone().lastProgress().await?;
println!("{}", val);
}
// stop the active stream
query.stop().await?;
Ok(())
}
pub async fn status(self) -> Result<StatusResult, SparkError>
Trait Implementations§
source§impl Clone for StreamingQuery
impl Clone for StreamingQuery
source§fn clone(&self) -> StreamingQuery
fn clone(&self) -> StreamingQuery
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 StreamingQuery
impl !RefUnwindSafe for StreamingQuery
impl Send for StreamingQuery
impl Sync for StreamingQuery
impl Unpin for StreamingQuery
impl !UnwindSafe for StreamingQuery
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> 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