Skip to content

StreamingQueryWrapper — Serializable StreamExecution

StreamingQueryWrapper is a serializable interface of a StreamExecution.

StreamingQueryWrapper has the same StreamExecution API and simply passes all the method calls along to the underlying StreamExecution.

StreamingQueryWrapper is created when StreamingQueryManager is requested to create a streaming query (when DataStreamWriter is requested to start an execution of the streaming query).

Demo: Any Streaming Query is StreamingQueryWrapper

import org.apache.spark.sql.execution.streaming.StreamingQueryWrapper
val query = spark
  .readStream
  .format("rate")
  .load
  .writeStream
  .format("memory")
  .queryName("rate2memory")
  .start
assert(query.isInstanceOf[StreamingQueryWrapper])