管理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