Package

org.apache.spark.sql.execution

streaming

Permalink

package streaming

Visibility
  1. Public
  2. All

Type Members

  1. abstract class CompactibleFileStreamLog[T <: AnyRef] extends HDFSMetadataLog[Array[T]]

    Permalink

    An abstract class for compactible metadata logs.

    An abstract class for compactible metadata logs. It will write one log file for each batch. The first line of the log file is the version number, and there are multiple serialized metadata lines following.

    As reading from many small files is usually pretty slow, also too many small files in one folder will mess the FS, CompactibleFileStreamLog will compact log files every 10 batches by default into a big file. When doing a compaction, it will read all old log files and merge them with the new batch.

  2. class ConsoleSink extends Sink with Logging

    Permalink
  3. class ConsoleSinkProvider extends StreamSinkProvider with DataSourceRegister

    Permalink
  4. case class EventTimeStats(max: Long, min: Long, sum: Long, count: Long) extends Product with Serializable

    Permalink

    Class for collecting event time stats with an accumulator

  5. class EventTimeStatsAccum extends AccumulatorV2[Long, EventTimeStats]

    Permalink

    Accumulator that collects stats on event time in a batch.

  6. case class EventTimeWatermarkExec(eventTime: Attribute, delay: CalendarInterval, child: SparkPlan) extends SparkPlan with Product with Serializable

    Permalink

    Used to mark a column as the containing the event time for a given record.

    Used to mark a column as the containing the event time for a given record. In addition to adding appropriate metadata to this column, this operator also tracks the maximum observed event time. Based on the maximum observed time and a user specified delay, we can calculate the watermark after which we assume we will no longer see late records for a particular time period. Note that event time is measured in milliseconds.

  7. class FileStreamOptions extends Logging

    Permalink

    User specified options for file streams.

  8. class FileStreamSink extends Sink with Logging

    Permalink

    A sink that writes out results to parquet files.

    A sink that writes out results to parquet files. Each batch is written out to a unique directory. After all of the files in a batch have been successfully written, the list of file paths is appended to the log atomically. In the case of partial failures, some duplicate data may be present in the target directory, but only one copy of each file will be present in the log.

  9. class FileStreamSinkLog extends CompactibleFileStreamLog[SinkFileStatus]

    Permalink

    A special log for FileStreamSink.

    A special log for FileStreamSink. It will write one log file for each batch. The first line of the log file is the version number, and there are multiple JSON lines following. Each JSON line is a JSON format of SinkFileStatus.

    As reading from many small files is usually pretty slow, FileStreamSinkLog will compact log files every "spark.sql.sink.file.log.compactLen" batches into a big file. When doing a compaction, it will read all old log files and merge them with the new batch. During the compaction, it will also delete the files that are deleted (marked by SinkFileStatus.action). When the reader uses allFiles to list all files, this method only returns the visible files (drops the deleted files).

  10. class FileStreamSource extends Source with Logging

    Permalink

    A very simple source that reads files from the given directory as they appear.

  11. class FileStreamSourceLog extends CompactibleFileStreamLog[FileEntry]

    Permalink
  12. case class FileStreamSourceOffset(logOffset: Long) extends Offset with Product with Serializable

    Permalink

    Offset for the FileStreamSource.

    Offset for the FileStreamSource.

    logOffset

    Position in the FileStreamSourceLog

  13. class ForeachSink[T] extends Sink with Serializable

    Permalink

    A Sink that forwards all data into ForeachWriter according to the contract defined by ForeachWriter.

    A Sink that forwards all data into ForeachWriter according to the contract defined by ForeachWriter.

    T

    The expected type of the sink.

  14. class HDFSMetadataLog[T <: AnyRef] extends MetadataLog[T] with Logging

    Permalink

    A MetadataLog implementation based on HDFS.

    A MetadataLog implementation based on HDFS. HDFSMetadataLog uses the specified path as the metadata storage.

    When writing a new batch, HDFSMetadataLog will firstly write to a temp file and then rename it to the final batch file. If the rename step fails, there must be multiple writers and only one of them will succeed and the others will fail.

    Note: HDFSMetadataLog doesn't support S3-like file systems as they don't guarantee listing files in a directory always shows the latest files.

  15. class IncrementalExecution extends QueryExecution with Logging

    Permalink

    A variant of QueryExecution that allows the execution of the given LogicalPlan plan incrementally.

    A variant of QueryExecution that allows the execution of the given LogicalPlan plan incrementally. Possibly preserving state in between each execution.

  16. case class LongOffset(offset: Long) extends Offset with Product with Serializable

    Permalink

    A simple offset for sources that produce a single linear stream of data.

  17. class ManifestFileCommitProtocol extends FileCommitProtocol with Serializable with Logging

    Permalink

    A FileCommitProtocol that tracks the list of valid files in a manifest file, used in structured streaming.

  18. case class MemoryPlan(sink: MemorySink, output: Seq[Attribute]) extends LeafNode with Product with Serializable

    Permalink

    Used to query the data that has been written into a MemorySink.

  19. class MemorySink extends Sink with Logging

    Permalink

    A sink that stores the results in memory.

    A sink that stores the results in memory. This Sink is primarily intended for use in unit tests and does not provide durability.

  20. case class MemoryStream[A](id: Int, sqlContext: SQLContext)(implicit evidence$2: Encoder[A]) extends Source with Logging with Product with Serializable

    Permalink

    A Source that produces value stored in memory as they are added by the user.

    A Source that produces value stored in memory as they are added by the user. This Source is primarily intended for use in unit tests as it can only replay data when the object is still available.

  21. trait MetadataLog[T] extends AnyRef

    Permalink

    A general MetadataLog that supports the following features:

    A general MetadataLog that supports the following features:

    • Allow the user to store a metadata object for each batch.
    • Allow the user to query the latest batch id.
    • Allow the user to query the metadata object of a specified batch id.
    • Allow the user to query metadata objects in a range of batch ids.
    • Allow the user to remove obsolete metadata
  22. class MetadataLogFileIndex extends PartitioningAwareFileIndex

    Permalink

    A FileIndex that generates the list of files to processing by reading them from the metadata log files generated by the FileStreamSink.

  23. class MetricsReporter extends metrics.source.Source with Logging

    Permalink

    Serves metrics from a org.apache.spark.sql.streaming.StreamingQuery to Codahale/DropWizard metrics

  24. abstract class Offset extends AnyRef

    Permalink

    An offset is a monotonically increasing metric used to track progress in the computation of a stream.

    An offset is a monotonically increasing metric used to track progress in the computation of a stream. Since offsets are retrieved from a Source by a single thread, we know the global ordering of two Offset instances. We do assume that if two offsets are equal then no new data has arrived.

  25. case class OffsetSeq(offsets: Seq[Option[Offset]], metadata: Option[OffsetSeqMetadata] = None) extends Product with Serializable

    Permalink

    An ordered collection of offsets, used to track the progress of processing data from one or more Sources that are present in a streaming query.

    An ordered collection of offsets, used to track the progress of processing data from one or more Sources that are present in a streaming query. This is similar to simplified, single-instance vector clock that must progress linearly forward.

  26. class OffsetSeqLog extends HDFSMetadataLog[OffsetSeq]

    Permalink

    This class is used to log offsets to persistent files in HDFS.

    This class is used to log offsets to persistent files in HDFS. Each file corresponds to a specific batch of offsets. The file format contain a version string in the first line, followed by a the JSON string representation of the offsets separated by a newline character. If a source offset is missing, then that line will contain a string value defined in the SERIALIZED_VOID_OFFSET variable in OffsetSeqLog companion object. For instance, when dealing with LongOffset types: v1 // version 1 metadata {0} // LongOffset 0 {3} // LongOffset 3

    • // No offset for this source i.e., an invalid JSON string {2} // LongOffset 2 ...
  27. case class OffsetSeqMetadata(batchWatermarkMs: Long = 0, batchTimestampMs: Long = 0) extends Product with Serializable

    Permalink

    Contains metadata associated with a OffsetSeq.

    Contains metadata associated with a OffsetSeq. This information is persisted to the offset log in the checkpoint location via the OffsetSeq metadata field.

  28. case class OperatorStateId(checkpointLocation: String, operatorId: Long, batchId: Long) extends Product with Serializable

    Permalink

    Used to identify the state store for a given operator.

  29. case class ProcessingTimeExecutor(processingTime: ProcessingTime, clock: Clock = new SystemClock()) extends TriggerExecutor with Logging with Product with Serializable

    Permalink

    A trigger executor that runs a batch every intervalMs milliseconds.

  30. trait ProgressReporter extends Logging

    Permalink

    Responsible for continually reporting statistics about the amount of data processed as well as latency for a streaming query.

    Responsible for continually reporting statistics about the amount of data processed as well as latency for a streaming query. This trait is designed to be mixed into the StreamExecution, who is responsible for calling startTrigger and finishTrigger at the appropriate times. Additionally, the status can updated with updateStatusMessage to allow reporting on the streams current state (i.e. "Fetching more data").

  31. case class SerializedOffset(json: String) extends Offset with Product with Serializable

    Permalink

    Used when loading a JSON serialized offset from external storage.

    Used when loading a JSON serialized offset from external storage. We are currently not responsible for converting JSON serialized data into an internal (i.e., object) representation. Sources should define a factory method in their source Offset companion objects that accepts a SerializedOffset for doing the conversion.

  32. trait Sink extends AnyRef

    Permalink

    An interface for systems that can collect the results of a streaming query.

    An interface for systems that can collect the results of a streaming query. In order to preserve exactly once semantics a sink must be idempotent in the face of multiple attempts to add the same batch.

  33. case class SinkFileStatus(path: String, size: Long, isDir: Boolean, modificationTime: Long, blockReplication: Int, blockSize: Long, action: String) extends Product with Serializable

    Permalink

    The status of a file outputted by FileStreamSink.

    The status of a file outputted by FileStreamSink. A file is visible only if it appears in the sink log and its action is not "delete".

    path

    the file path.

    size

    the file size.

    isDir

    whether this file is a directory.

    modificationTime

    the file last modification time.

    blockReplication

    the block replication.

    blockSize

    the block size.

    action

    the file action. Must be either "add" or "delete".

  34. trait Source extends AnyRef

    Permalink

    A source of continually arriving data for a streaming query.

    A source of continually arriving data for a streaming query. A Source must have a monotonically increasing notion of progress that can be represented as an Offset. Spark will regularly query each Source to see if any more data is available.

  35. case class StateStoreRestoreExec(keyExpressions: Seq[Attribute], stateId: Option[OperatorStateId], child: SparkPlan) extends SparkPlan with UnaryExecNode with StatefulOperator with Product with Serializable

    Permalink

    For each input tuple, the key is calculated and the value from the StateStore is added to the stream (in addition to the input tuple) if present.

  36. case class StateStoreSaveExec(keyExpressions: Seq[Attribute], stateId: Option[OperatorStateId] = None, outputMode: Option[OutputMode] = None, eventTimeWatermark: Option[Long] = None, child: SparkPlan) extends SparkPlan with UnaryExecNode with StatefulOperator with Product with Serializable

    Permalink

    For each input tuple, the key is calculated and the tuple is put into the StateStore.

  37. trait StatefulOperator extends SparkPlan

    Permalink

    An operator that saves or restores state from the StateStore.

    An operator that saves or restores state from the StateStore. The OperatorStateId should be filled in by prepareForExecution in IncrementalExecution.

  38. class StreamExecution extends StreamingQuery with ProgressReporter with Logging

    Permalink

    Manages the execution of a streaming Spark SQL query that is occurring in a separate thread.

    Manages the execution of a streaming Spark SQL query that is occurring in a separate thread. Unlike a standard query, a streaming query executes repeatedly each time new data arrives at any Source present in the query plan. Whenever new data arrives, a QueryExecution is created and the results are committed transactionally to the given Sink.

  39. abstract class StreamExecutionThread extends UninterruptibleThread

    Permalink

    A special thread to run the stream query.

    A special thread to run the stream query. Some codes require to run in the StreamExecutionThread and will use classOf[StreamExecutionThread] to check.

  40. case class StreamMetadata(id: String) extends Product with Serializable

    Permalink

    Contains metadata associated with a StreamingQuery.

    Contains metadata associated with a StreamingQuery. This information is written in the checkpoint location the first time a query is started and recovered every time the query is restarted.

    id

    unique id of the StreamingQuery that needs to be persisted across restarts

  41. class StreamProgress extends Map[Source, Offset]

    Permalink

    A helper class that looks like a Map[Source, Offset].

  42. case class StreamingExecutionRelation(source: Source, output: Seq[Attribute]) extends LeafNode with Product with Serializable

    Permalink

    Used to link a streaming Source of data into a org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.

  43. class StreamingQueryListenerBus extends SparkListener with ListenerBus[StreamingQueryListener, Event]

    Permalink

    A bus to forward events to StreamingQueryListeners.

    A bus to forward events to StreamingQueryListeners. This one will send received StreamingQueryListener.Events to the Spark listener bus. It also registers itself with Spark listener bus, so that it can receive StreamingQueryListener.Events and dispatch them to StreamingQueryListeners.

    Note that each bus and its registered listeners are associated with a single SparkSession and StreamingQueryManager. So this bus will dispatch events to registered listeners for only those queries that were started in the associated SparkSession.

  44. class StreamingQueryWrapper extends StreamingQuery with Serializable

    Permalink

    Wrap non-serializable StreamExecution to make the query serializable as it's easy to for it to get captured with normal usage.

    Wrap non-serializable StreamExecution to make the query serializable as it's easy to for it to get captured with normal usage. It's safe to capture the query but not use it in executors. However, if the user tries to call its methods, it will throw IllegalStateException.

  45. case class StreamingRelation(dataSource: DataSource, sourceName: String, output: Seq[Attribute]) extends LeafNode with Product with Serializable

    Permalink

    Used to link a streaming DataSource into a org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.

    Used to link a streaming DataSource into a org.apache.spark.sql.catalyst.plans.logical.LogicalPlan. This is only used for creating a streaming org.apache.spark.sql.DataFrame from org.apache.spark.sql.DataFrameReader. It should be used to create Source and converted to StreamingExecutionRelation when passing to StreamExecution to run a query.

  46. case class StreamingRelationExec(sourceName: String, output: Seq[Attribute]) extends SparkPlan with LeafExecNode with Product with Serializable

    Permalink

    A dummy physical plan for StreamingRelation to support org.apache.spark.sql.Dataset.explain

  47. class TextSocketSource extends Source with Logging

    Permalink

    A source that reads text lines through a TCP socket, designed only for tutorials and debugging.

    A source that reads text lines through a TCP socket, designed only for tutorials and debugging. This source will *not* work in production applications due to multiple reasons, including no support for fault recovery and keeping all of the text read in memory forever.

  48. class TextSocketSourceProvider extends StreamSourceProvider with DataSourceRegister with Logging

    Permalink
  49. trait TriggerExecutor extends AnyRef

    Permalink

Value Members

  1. object CompactibleFileStreamLog

    Permalink
  2. object EventTimeStats extends Serializable

    Permalink
  3. object FileStreamSink

    Permalink
  4. object FileStreamSinkLog

    Permalink
  5. object FileStreamSource

    Permalink
  6. object FileStreamSourceLog

    Permalink
  7. object FileStreamSourceOffset extends Serializable

    Permalink
  8. object HDFSMetadataLog

    Permalink
  9. object LongOffset extends Serializable

    Permalink
  10. object MemoryStream extends Serializable

    Permalink
  11. object OffsetSeq extends Serializable

    Permalink
  12. object OffsetSeqLog

    Permalink
  13. object OffsetSeqMetadata extends Serializable

    Permalink
  14. object SinkFileStatus extends Serializable

    Permalink
  15. object StreamMetadata extends Logging with Serializable

    Permalink
  16. object StreamingExecutionRelation extends Serializable

    Permalink
  17. object StreamingRelation extends Serializable

    Permalink
  18. object TextSocketSource

    Permalink
  19. package state

    Permalink

Ungrouped