Method that generates a RDD for the given time
List of parent DStreams on which this DStream depends on
Time interval after which the DStream generates a RDD
Persist RDDs of this DStream with the default storage level (MEMORY_ONLY_SER)
Enable periodic checkpointing of RDDs of this DStream
Enable periodic checkpointing of RDDs of this DStream
Time interval after which generated RDD will be checkpointed
Clear metadata that are older than rememberDuration
of this DStream.
Clear metadata that are older than rememberDuration
of this DStream.
This is an internal method that should not be called directly. This default
implementation clears the old generated RDDs. Subclasses of DStream may override
this to clear their own metadata along with the generated RDDs.
Return the StreamingContext associated with this DStream
Return a new DStream in which each RDD has a single element generated by counting each RDD of this DStream.
Return a new DStream in which each RDD contains the counts of each distinct value in each RDD of this DStream.
Return a new DStream in which each RDD contains the counts of each distinct value in
each RDD of this DStream. Hash partitioning is used to generate
the RDDs with numPartitions
partitions (Spark's default number of partitions if
numPartitions
not specified).
Return a new DStream in which each RDD contains the count of distinct elements in RDDs in a sliding window over this DStream.
Return a new DStream in which each RDD contains the count of distinct elements in
RDDs in a sliding window over this DStream. Hash partitioning is used to generate
the RDDs with numPartitions
partitions (Spark's default number of partitions if
numPartitions
not specified).
width of the window; must be a multiple of this DStream's batching interval
sliding interval of the window (i.e., the interval after which the new DStream will generate RDDs); must be a multiple of this DStream's batching interval
number of partitions of each RDD in the new DStream.
Return a new DStream in which each RDD has a single element generated by counting the number of elements in a sliding window over this DStream.
Return a new DStream in which each RDD has a single element generated by counting the number of elements in a sliding window over this DStream. Hash partitioning is used to generate the RDDs with Spark's default number of partitions.
width of the window; must be a multiple of this DStream's batching interval
sliding interval of the window (i.e., the interval after which the new DStream will generate RDDs); must be a multiple of this DStream's batching interval
Return a new DStream containing only the elements that satisfy a predicate.
Return a new DStream by applying a function to all elements of this DStream, and then flattening the results
Apply a function to each RDD in this DStream.
Apply a function to each RDD in this DStream. This is an output operator, so this DStream will be registered as an output stream and therefore materialized.
Apply a function to each RDD in this DStream.
Apply a function to each RDD in this DStream. This is an output operator, so this DStream will be registered as an output stream and therefore materialized.
Generate a SparkStreaming job for the given time.
Generate a SparkStreaming job for the given time. This is an internal method that should not be called directly. This default implementation creates a job that materializes the corresponding RDD. Subclasses of DStream may override this to generate their own jobs.
Retrieve a precomputed RDD of this DStream, or computes the RDD.
Retrieve a precomputed RDD of this DStream, or computes the RDD. This is an internal method that should not be called directly.
Return a new DStream in which each RDD is generated by applying glom() to each RDD of this DStream.
Return a new DStream in which each RDD is generated by applying glom() to each RDD of this DStream. Applying glom() to an RDD coalesces all elements within each partition into an array.
Initialize the DStream by setting the "zero" time, based on which the validity of future times is calculated.
Initialize the DStream by setting the "zero" time, based on which the validity of future times is calculated. This method also recursively initializes its parent DStreams.
Checks whether the 'time' is valid wrt slideDuration for generating RDD
Checks whether the 'time' is valid wrt slideDuration for generating RDD
Return a new DStream by applying a function to all elements of this DStream.
Return a new DStream in which each RDD is generated by applying mapPartitions() to each RDDs of this DStream.
Return a new DStream in which each RDD is generated by applying mapPartitions() to each RDDs of this DStream. Applying mapPartitions() to an RDD applies a function to each partition of the RDD.
Persist RDDs of this DStream with the default storage level (MEMORY_ONLY_SER)
Persist the RDDs of this DStream with the given storage level
Print the first ten elements of each RDD generated in this DStream.
Print the first ten elements of each RDD generated in this DStream. This is an output operator, so this DStream will be registered as an output stream and there materialized.
Return a new DStream in which each RDD has a single element generated by reducing each RDD of this DStream.
Return a new DStream in which each RDD has a single element generated by reducing all elements in a sliding window over this DStream.
Return a new DStream in which each RDD has a single element generated by reducing all elements in a sliding window over this DStream. However, the reduction is done incrementally using the old window's reduced value :
associative reduce function
inverse reduce function
width of the window; must be a multiple of this DStream's batching interval
sliding interval of the window (i.e., the interval after which the new DStream will generate RDDs); must be a multiple of this DStream's batching interval
Return a new DStream in which each RDD has a single element generated by reducing all elements in a sliding window over this DStream.
Return a new DStream in which each RDD has a single element generated by reducing all elements in a sliding window over this DStream.
associative reduce function
width of the window; must be a multiple of this DStream's batching interval
sliding interval of the window (i.e., the interval after which the new DStream will generate RDDs); must be a multiple of this DStream's batching interval
Restore the RDDs in generatedRDDs from the checkpointData.
Restore the RDDs in generatedRDDs from the checkpointData. This is an internal method that should not be called directly. This is a default implementation that recreates RDDs from the checkpoint file names stored in checkpointData. Subclasses of DStream that override the updateCheckpointData() method would also need to override this method.
Save each RDD in this DStream as a Sequence file of serialized objects.
Save each RDD in this DStream as a Sequence file of serialized objects.
The file name at each batch interval is generated based on prefix
and
suffix
: "prefix-TIME_IN_MS.suffix".
Save each RDD in this DStream as at text file, using string representation of elements.
Save each RDD in this DStream as at text file, using string representation
of elements. The file name at each batch interval is generated based on
prefix
and suffix
: "prefix-TIME_IN_MS.suffix".
Return all the RDDs between 'fromTime' to 'toTime' (both included)
Return all the RDDs defined by the Interval object (both end times included)
Return all the RDDs defined by the Interval object (both end times included)
Return a new DStream in which each RDD is generated by applying a function on each RDD of this DStream.
Return a new DStream in which each RDD is generated by applying a function on each RDD of this DStream.
Return a new DStream by unifying data of another DStream with this DStream.
Return a new DStream by unifying data of another DStream with this DStream.
Another DStream having the same slideDuration as this DStream.
Refresh the list of checkpointed RDDs that will be saved along with checkpoint of this stream.
Refresh the list of checkpointed RDDs that will be saved along with checkpoint of this stream. This is an internal method that should not be called directly. This is a default implementation that saves only the file names of the checkpointed RDDs to checkpointData. Subclasses of DStream (especially those of InputDStream) may override this method to save custom checkpoint data.
Return a new DStream in which each RDD contains all the elements in seen in a sliding window of time over this DStream.
Return a new DStream in which each RDD contains all the elements in seen in a sliding window of time over this DStream.
width of the window; must be a multiple of this DStream's batching interval
sliding interval of the window (i.e., the interval after which the new DStream will generate RDDs); must be a multiple of this DStream's batching interval
Return a new DStream in which each RDD contains all the elements in seen in a sliding window of time over this DStream.
Return a new DStream in which each RDD contains all the elements in seen in a sliding window of time over this DStream. The new DStream generates RDDs with the same interval as this DStream.
width of the window; must be a multiple of this DStream's interval.
A Discretized Stream (DStream), the basic abstraction in Spark Streaming, is a continuous sequence of RDDs (of the same type) representing a continuous stream of data (see spark.RDD for more details on RDDs). DStreams can either be created from live data (such as, data from HDFS, Kafka or Flume) or it can be generated by transformation existing DStreams using operations such as
map
,window
andreduceByKeyAndWindow
. While a Spark Streaming program is running, each DStream periodically generates a RDD, either from live data or by transforming the RDD generated by a parent DStream.This class contains the basic operations available on all DStreams, such as
map
,filter
andwindow
. In addition, PairDStreamFunctions contains operations available only on DStreams of key-value pairs, such asgroupByKeyAndWindow
andjoin
. These operations are automatically available on any DStream of the right type (e.g., DStream[(Int, Int)] through implicit conversions whenspark.streaming.StreamingContext._
is imported.DStreams internally is characterized by a few basic properties: