Packages

class MicroBatchExecution extends StreamExecution with AsyncLogPurge

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MicroBatchExecution
  2. AsyncLogPurge
  3. StreamExecution
  4. Logging
  5. StreamingQuery
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new MicroBatchExecution(sparkSession: SparkSession, trigger: Trigger, triggerClock: Clock, extraOptions: Map[String, String], plan: WriteToStream)

Type Members

  1. implicit class LogStringContext extends AnyRef
    Definition Classes
    Logging

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val analyzedPlan: LogicalPlan
    Definition Classes
    StreamExecution
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def asyncLogPurgeShutdown(): Unit
    Attributes
    protected
    Definition Classes
    AsyncLogPurge
  7. def availableOffsets: StreamProgress

    Get the end or formerly know as "available" offsets of the latest batch that has been planned

    Get the end or formerly know as "available" offsets of the latest batch that has been planned

    Definition Classes
    StreamExecution
  8. def awaitInitialization(timeoutMs: Long): Unit

    Await until all fields of the query have been initialized.

    Await until all fields of the query have been initialized.

    Definition Classes
    StreamExecution
  9. val awaitProgressLock: ReentrantLock

    A lock used to wait/notify when batches complete.

    A lock used to wait/notify when batches complete. Use a fair lock to avoid thread starvation.

    Attributes
    protected
    Definition Classes
    StreamExecution
  10. val awaitProgressLockCondition: Condition
    Attributes
    protected
    Definition Classes
    StreamExecution
  11. def awaitTermination(timeoutMs: Long): Boolean

    Waits for the termination of this query, either by query.stop() or by an exception.

    Waits for the termination of this query, either by query.stop() or by an exception. If the query has terminated with an exception, then the exception will be thrown. Otherwise, it returns whether the query has terminated or not within the timeoutMs milliseconds.

    If the query has terminated, then all subsequent calls to this method will either return true immediately (if the query was terminated by stop()), or throw the exception immediately (if the query has terminated with exception).

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.0.0

    Exceptions thrown

    StreamingQueryException if the query has terminated with an exception

  12. def awaitTermination(): Unit

    Waits for the termination of this query, either by query.stop() or by an exception.

    Waits for the termination of this query, either by query.stop() or by an exception. If the query has terminated with an exception, then the exception will be thrown.

    If the query has terminated, then all subsequent calls to this method will either return immediately (if the query was terminated by stop()), or throw the exception immediately (if the query has terminated with exception).

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.0.0

    Exceptions thrown

    StreamingQueryException if the query has terminated with an exception.

  13. def checkpointFile(name: String): String

    Returns the path of a file with name in the checkpoint directory.

    Returns the path of a file with name in the checkpoint directory.

    Attributes
    protected
    Definition Classes
    StreamExecution
  14. def cleanUpLastExecutedMicroBatch(execCtx: MicroBatchExecutionContext): Unit
    Attributes
    protected
  15. def cleanup(): Unit

    Any clean up that needs to happen when the query is stopped or exits

    Any clean up that needs to happen when the query is stopped or exits

    Definition Classes
    MicroBatchExecutionStreamExecution
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  17. val commitLog: CommitLog

    A log that records the batch ids that have completed.

    A log that records the batch ids that have completed. This is used to check if a batch was fully processed, and its output was committed to the sink, hence no need to process it again. This is used (for instance) during restart, to help identify which batch to run next.

    Definition Classes
    StreamExecution
  18. def commitSources(offsetSeq: OffsetSeq): Unit
    Attributes
    protected
  19. var committedOffsets: StreamProgress

    Tracks how much data we have processed and committed to the sink or state store from each input source.

    Tracks how much data we have processed and committed to the sink or state store from each input source. Only the scheduler thread should modify this field, and only in atomic steps. Other threads should make a shallow copy if they are going to access this field more than once, since the field's value may change at any time.

    Definition Classes
    StreamExecution
  20. def createWrite(table: SupportsWrite, options: Map[String, String], inputPlan: LogicalPlan): Write
    Attributes
    protected
    Definition Classes
    StreamExecution
  21. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  23. val errorNotifier: ErrorNotifier
    Attributes
    protected[sql]
    Definition Classes
    MicroBatchExecutionAsyncLogPurge
  24. def exception: Option[StreamingQueryException]

    Returns the StreamingQueryException if the query was terminated by an exception.

    Returns the StreamingQueryException if the query was terminated by an exception.

    Definition Classes
    StreamExecutionStreamingQuery
  25. def explain(): Unit

    Prints the physical plan to the console for debugging purposes.

    Prints the physical plan to the console for debugging purposes.

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.0.0

  26. def explain(extended: Boolean): Unit

    Prints the physical plan to the console for debugging purposes.

    Prints the physical plan to the console for debugging purposes.

    extended

    whether to do extended explain or not

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.0.0

  27. def explainInternal(extended: Boolean): String

    Expose for tests

    Expose for tests

    Definition Classes
    StreamExecution
  28. def getBatchDescriptionString: String
    Attributes
    protected
    Definition Classes
    StreamExecution
  29. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  30. def getLatestExecutionContext(): StreamExecutionContext

    Get the latest execution context .

    Get the latest execution context .

    Definition Classes
    MicroBatchExecutionStreamExecution
  31. def getStartOffsetsOfLatestBatch: StreamProgress

    Get the start offsets of the latest batch that has been planned

    Get the start offsets of the latest batch that has been planned

    Definition Classes
    StreamExecution
  32. def getTrigger(): TriggerExecutor
    Attributes
    protected
  33. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  34. val id: UUID

    Returns the unique id of this query that persists across restarts from checkpoint data.

    Returns the unique id of this query that persists across restarts from checkpoint data. That is, this id is generated when a query is started for the first time, and will be the same every time it is restarted from checkpoint data. Also see runId.

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.1.0

  35. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  36. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  37. def interruptAndAwaitExecutionThreadTermination(): Unit

    Interrupts the query execution thread and awaits its termination until until it exceeds the timeout.

    Interrupts the query execution thread and awaits its termination until until it exceeds the timeout. The timeout can be set on "spark.sql.streaming.stopTimeout".

    Attributes
    protected
    Definition Classes
    StreamExecution
    Annotations
    @throws(scala.this.throws.<init>$default$1[java.util.concurrent.TimeoutException])
    Exceptions thrown

    TimeoutException If the thread cannot be stopped within the timeout

  38. def isActive: Boolean

    Whether the query is currently active or not

    Whether the query is currently active or not

    Definition Classes
    StreamExecutionStreamingQuery
  39. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  40. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  41. def lastExecution: IncrementalExecution
    Definition Classes
    StreamExecution
  42. def lastProgress: StreamingQueryProgress

    Returns the most recent StreamingQueryProgress update of this streaming query.

    Returns the most recent StreamingQueryProgress update of this streaming query.

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.1.0

  43. def latestOffsets: StreamProgress
    Definition Classes
    StreamExecution
  44. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  45. def logDebug(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  46. def logDebug(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  47. def logDebug(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  48. def logDebug(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  49. def logError(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  50. def logError(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  51. def logError(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  52. def logError(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  53. def logInfo(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  54. def logInfo(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  55. def logInfo(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  56. def logInfo(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  57. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  58. def logTrace(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  59. def logTrace(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  60. def logTrace(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  61. def logTrace(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  62. def logWarning(msg: => String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  63. def logWarning(entry: LogEntry, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  64. def logWarning(entry: LogEntry): Unit
    Attributes
    protected
    Definition Classes
    Logging
  65. def logWarning(msg: => String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  66. lazy val logicalPlan: LogicalPlan

    The base logical plan which will be used across batch runs.

    The base logical plan which will be used across batch runs. Once the value is set, it should not be modified.

    Definition Classes
    MicroBatchExecutionStreamExecution
  67. def markMicroBatchEnd(execCtx: MicroBatchExecutionContext): Unit

    Called after the microbatch has completed execution.

    Called after the microbatch has completed execution. It takes care of committing the offset to commit log and other bookkeeping.

    Attributes
    protected
  68. def markMicroBatchExecutionStart(execCtx: MicroBatchExecutionContext): Unit

    Method called once after the planning is done and before the start of the microbatch execution.

    Method called once after the planning is done and before the start of the microbatch execution. It can be used to perform any pre-execution tasks.

    Attributes
    protected
  69. def markMicroBatchStart(execCtx: MicroBatchExecutionContext): Unit

    Called at the start of the micro batch with given offsets.

    Called at the start of the micro batch with given offsets. It takes care of offset checkpointing to offset log and any microbatch startup tasks.

    Attributes
    protected
  70. val minLogEntriesToMaintain: Int
    Attributes
    protected
    Definition Classes
    StreamExecution
  71. val name: String

    Returns the user-specified name of the query, or null if not specified.

    Returns the user-specified name of the query, or null if not specified. This name can be specified in the org.apache.spark.sql.streaming.DataStreamWriter as dataframe.writeStream.queryName("query").start(). This name, if set, must be unique across all active queries.

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.0.0

  72. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  73. var noNewData: Boolean

    A flag to indicate that a batch has completed with no new data available.

    A flag to indicate that a batch has completed with no new data available.

    Attributes
    protected
    Definition Classes
    StreamExecution
  74. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  75. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  76. val offsetLog: OffsetSeqLog

    A write-ahead-log that records the offsets that are present in each batch.

    A write-ahead-log that records the offsets that are present in each batch. In order to ensure that a given batch will always consist of the same data, we write to this log *before* any processing is done. Thus, the Nth record in this log indicated data that is currently being processed and the N-1th entry indicates which offsets have been durably committed to the sink.

    Definition Classes
    StreamExecution
  77. val outputMode: OutputMode
    Definition Classes
    StreamExecution
  78. val pollingDelayMs: Long
    Attributes
    protected
    Definition Classes
    StreamExecution
  79. def populateStartOffsets(execCtx: MicroBatchExecutionContext, sparkSessionToRunBatches: SparkSession): Unit

    Populate the start offsets to start the execution at the current offsets stored in the sink (i.e.

    Populate the start offsets to start the execution at the current offsets stored in the sink (i.e. avoid reprocessing data that we have already processed). This function must be called before any processing occurs and will populate the following fields in the execution context of this micro-batch

    • batchId
    • startOffset
    • endOffsets The basic structure of this method is as follows:

    Identify (from the offset log) the offsets used to run the last batch IF last batch exists THEN Set the next batch to be executed as the last recovered batch Check the commit log to see which batch was committed last IF the last batch was committed THEN Call getBatch using the last batch start and end offsets // ^^^^ above line is needed since some sources assume last batch always re-executes Setup for a new batch i.e., start = last batch end, and identify new end DONE ELSE Identify a brand new batch DONE

    Attributes
    protected
  80. def postEvent(event: Event): Unit
    Attributes
    protected
    Definition Classes
    StreamExecution
  81. val prettyIdString: String

    Pretty identified string of printing in logs.

    Pretty identified string of printing in logs. Format is If name is set "queryName [id = xyz, runId = abc]" else "[id = xyz, runId = abc]"

    Attributes
    protected
    Definition Classes
    StreamExecution
  82. def processAllAvailable(): Unit

    Blocks until all available data in the source has been processed and committed to the sink.

    Blocks until all available data in the source has been processed and committed to the sink. This method is intended for testing. Note that in the case of continually arriving data, this method may block forever. Additionally, this method is only guaranteed to block until data that has been synchronously appended data to a org.apache.spark.sql.execution.streaming.Source prior to invocation. (i.e. getOffset must immediately reflect the addition).

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.0.0

  83. val progressReporter: ProgressReporter
    Attributes
    protected
    Definition Classes
    StreamExecution
  84. def purge(threshold: Long): Unit
    Attributes
    protected
    Definition Classes
    StreamExecution
  85. def purgeAsync(batchId: Long): Unit
    Attributes
    protected
    Definition Classes
    AsyncLogPurge
  86. val queryExecutionThread: QueryExecutionThread

    The thread that runs the micro-batches of this stream.

    The thread that runs the micro-batches of this stream. Note that this thread must be org.apache.spark.util.UninterruptibleThread to workaround KAFKA-1894: interrupting a running KafkaConsumer may cause endless loop.

    Definition Classes
    StreamExecution
  87. def recentProgress: Array[StreamingQueryProgress]

    Returns an array of the most recent StreamingQueryProgress updates for this query.

    Returns an array of the most recent StreamingQueryProgress updates for this query. The number of progress updates retained for each stream is configured by Spark session configuration spark.sql.streaming.numRecentProgressUpdates.

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.1.0

  88. val resolvedCheckpointRoot: String
    Definition Classes
    StreamExecution
  89. def runActivatedStream(sparkSessionForStream: SparkSession): Unit

    Repeatedly attempts to run batches as data arrives.

    Repeatedly attempts to run batches as data arrives.

    Attributes
    protected
    Definition Classes
    MicroBatchExecutionStreamExecution
  90. val runId: UUID

    Returns the unique id of this run of the query.

    Returns the unique id of this run of the query. That is, every start/restart of a query will generate a unique runId. Therefore, every time a query is restarted from checkpoint, it will have the same id but different runIds.

    Definition Classes
    StreamExecutionStreamingQuery
  91. def setLatestExecutionContext(ctx: StreamExecutionContext): Unit

    We will only set the lastExecutionContext only if the batch id is larger than the batch id of the current latestExecutionContext.

    We will only set the lastExecutionContext only if the batch id is larger than the batch id of the current latestExecutionContext. This is done to make sure we will always tracking the latest execution context i.e. we will never set latestExecutionContext to a earlier / older batch.

  92. val sink: Table
    Definition Classes
    StreamExecution
  93. var sources: Seq[SparkDataStream]

    The list of stream instances which will be used across batch runs.

    The list of stream instances which will be used across batch runs. Once the value is set, it should not be modified.

    Attributes
    protected
    Definition Classes
    MicroBatchExecutionStreamExecution
  94. val sparkSession: SparkSession

    Returns the SparkSession associated with this.

    Returns the SparkSession associated with this.

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.0.0

  95. def start(): Unit

    Starts the execution.

    Starts the execution. This returns only after the thread has started and QueryStartedEvent has been posted to all the listeners.

    Definition Classes
    StreamExecution
  96. val state: AtomicReference[State]

    Defines the internal state of execution

    Defines the internal state of execution

    Attributes
    protected
    Definition Classes
    StreamExecution
  97. def status: StreamingQueryStatus

    Returns the current status of the query.

    Returns the current status of the query.

    Definition Classes
    StreamExecutionStreamingQuery
    Since

    2.0.2

  98. def stop(): Unit

    Signals to the thread executing micro-batches that it should stop running after the next batch.

    Signals to the thread executing micro-batches that it should stop running after the next batch. This method blocks until the thread stops running.

    Definition Classes
    MicroBatchExecutionStreamingQuery
  99. def stopSources(): Unit

    Stops all streaming sources safely.

    Stops all streaming sources safely.

    Attributes
    protected
    Definition Classes
    StreamExecution
  100. var streamDeathCause: StreamingQueryException
    Attributes
    protected
    Definition Classes
    StreamExecution
  101. val streamMetadata: StreamMetadata

    Metadata associated with the whole query

    Metadata associated with the whole query

    Attributes
    protected
    Definition Classes
    StreamExecution
  102. lazy val streamMetrics: MetricsReporter

    Used to report metrics to coda-hale.

    Used to report metrics to coda-hale. This uses id for easier tracking across restarts.

    Definition Classes
    StreamExecution
  103. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  104. def toString(): String
    Definition Classes
    StreamExecution → AnyRef → Any
  105. val trigger: Trigger
    Definition Classes
    StreamExecution
  106. val triggerClock: Clock
    Definition Classes
    StreamExecution
  107. var triggerExecutor: TriggerExecutor
    Attributes
    protected[sql]
  108. var uniqueSources: Map[SparkDataStream, ReadLimit]

    A list of unique sources in the query plan.

    A list of unique sources in the query plan. This will be set when generating logical plan.

    Attributes
    protected
    Definition Classes
    StreamExecution
  109. lazy val useAsyncPurge: Boolean
    Attributes
    protected
    Definition Classes
    AsyncLogPurge
  110. def validateOffsetLogAndGetPrevOffset(latestBatchId: Long): Option[OffsetSeq]

    Conduct sanity checks on the offset log to make sure it is correct and expected.

    Conduct sanity checks on the offset log to make sure it is correct and expected. Also return the previous offset written to the offset log

    latestBatchId

    the batch id of the current micro batch

    returns

    A option that contains the offset of the previously written batch

  111. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  112. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  113. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  114. val watermarkMsMap: Map[Int, Long]

    A map of current watermarks, keyed by the position of the watermark operator in the physical plan.

    A map of current watermarks, keyed by the position of the watermark operator in the physical plan.

    This state is 'soft state', which does not affect the correctness and semantics of watermarks and is not persisted across query restarts. The fault-tolerant watermark state is in offsetSeqMetadata.

    Attributes
    protected
    Definition Classes
    StreamExecution
  115. var watermarkTracker: WatermarkTracker
    Attributes
    protected
  116. def withLogContext(context: HashMap[String, String])(body: => Unit): Unit
    Attributes
    protected
    Definition Classes
    Logging

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AsyncLogPurge

Inherited from StreamExecution

Inherited from Logging

Inherited from StreamingQuery

Inherited from AnyRef

Inherited from Any

Ungrouped