美文网首页
206、Spark 2.0之Structured Streami

206、Spark 2.0之Structured Streami

作者: ZFH__ZJ | 来源:发表于2019-02-12 17:30 被阅读0次

    管理streaming query

    val query = df.writeStream.format("console").start()   // get the query object
    query.id          // get the unique identifier of the running query
    query.name        // get the name of the auto-generated or user-specified name
    query.explain()   // print detailed explanations of the query
    query.stop()      // stop the query 
    query.awaitTermination()   // block until query is terminated, with stop() or with error
    query.exception()    // the exception if the query has been terminated with error
    query.sourceStatus()  // progress information about data has been read from the input sources
    query.sinkStatus()   // progress information about data written to the output sink
    
    
    val spark: SparkSession = ...
    spark.streams.active    // get the list of currently active streaming queries
    spark.streams.get(id)   // get a query object by its unique id
    spark.streams.awaitAnyTermination()   // block until any one of them terminates
    

    相关文章

      网友评论

          本文标题:206、Spark 2.0之Structured Streami

          本文链接:https://www.haomeiwen.com/subject/yygceqtx.html