Class: DStream

eclairjs/streaming/dstream. DStream

new DStream(jDStream)

Parameters:
Name Type Description
jDStream object
Source:

Methods

cache() → {module:eclairjs/streaming/dstream.DStream}

Persist RDDs of this DStream with the default storage level (MEMORY_ONLY_SER)
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

checkpoint(interval) → {module:eclairjs/streaming/dstream.DStream}

Enable periodic checkpointing of RDDs of this DStream.
Parameters:
Name Type Description
interval module:eclairjs/streaming.Duration
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

compute(validTime) → {module:eclairjs.RDD}

Generate an RDD for the given duration
Parameters:
Name Type Description
validTime module:eclairjs/streaming.Time
Source:
Returns:
Type
module:eclairjs.RDD

context() → {module:eclairjs/streaming.StreamingContext}

Return the StreamingContext associated with this DStream
Source:
Returns:
Type
module:eclairjs/streaming.StreamingContext

count() → {module:eclairjs/streaming/dstream.DStream}

Return a new DStream in which each RDD has a single element generated by counting each RDD of this DStream.
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

countByValue(numPartitions) → {module:eclairjs/streaming/dstream.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 Spark's default number of partitions if numPartions is not specified.
Parameters:
Name Type Description
numPartitions int
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

countByValueAndWindow(windowDuration, slideDuration, numPartitions) → {module:eclairjs/streaming/dstream.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 Spark's default number of partitions if numPartitions is not specified.
Parameters:
Name Type Description
windowDuration module:eclairjs/streaming.Duration
slideDuration module:eclairjs/streaming.Duration
numPartitions int
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

countByValueAndWindow(windowDuration, slideDuration, numPartitionsopt) → {module:eclairjs/streaming/dstream.PairDStream}

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.
Parameters:
Name Type Attributes Description
windowDuration module:eclairjs/streaming.Duration width of the window; must be a multiple of this DStream's batching interval
slideDuration module:eclairjs/streaming.Duration 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
numPartitions number <optional>
number of partitions of each RDD in the new DStream.
Source:
Returns:
Type
module:eclairjs/streaming/dstream.PairDStream

countByWindow(windowDuration, slideDuration) → {module:eclairjs/streaming/dstream.DStream}

Return a new DStream in which each RDD has a single element generated by counting the number of elements in a window over this DStream. windowDuration and slideDuration are as defined in the window() operation. This is equivalent to window(windowDuration, slideDuration).count()
Parameters:
Name Type Description
windowDuration module:eclairjs/streaming.Duration
slideDuration module:eclairjs/streaming.Duration
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

filter(func, bindArgsopt) → {module:eclairjs/streaming/dstream.DStream}

Return a new DStream containing only the elements that satisfy a predicate.
Parameters:
Name Type Attributes Description
func function
bindArgs Array.<Object> <optional>
array whose values will be added to func's argument list.
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

flatMap(func, bindArgsopt) → {module:eclairjs/streaming/dstream.DStream}

Return a new DStream by first applying a function to all elements of this DStream, and then flattening the results.
Parameters:
Name Type Attributes Description
func
bindArgs Array.<Object> <optional>
array whose values will be added to func's argument list.
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

flatMapToPair(func, bindArgsopt) → {module:eclairjs/streaming/dstream.PairDStream}

Return a new DStream by applying a function to all elements of this DStream, and then flattening the results
Parameters:
Name Type Attributes Description
func
bindArgs Array.<Object> <optional>
array whose values will be added to func's argument list.
Source:
Returns:
Type
module:eclairjs/streaming/dstream.PairDStream

foreachRDD(func, bindArgsopt) → {void}

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.
Parameters:
Name Type Attributes Description
func
bindArgs Array.<Object> <optional>
array whose values will be added to func's argument list.
Source:
Returns:
Type
void

foreachRDDWithTime(func, bindArgsopt) → {void}

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. The time is passed into to the function.
Parameters:
Name Type Attributes Description
func
bindArgs Array.<Object> <optional>
array whose values will be added to func's argument list.
Source:
Returns:
Type
void

glom()

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.
Source:

map(func, bindArgsopt) → {module:eclairjs/streaming/dstream.DStream}

Return a new DStream by applying a function to all elements of this DStream.
Parameters:
Name Type Attributes Description
func
bindArgs Array.<Object> <optional>
array whose values will be added to func's argument list.
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

mapPartitions(func, bindArgsopt) → {module:eclairjs/streaming/dstream.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.
Parameters:
Name Type Attributes Description
func
bindArgs Array.<Object> <optional>
array whose values will be added to func's argument list.
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

mapToPair(func, bindArgsopt) → {module:eclairjs/streaming/dstream.PairDStream}

Return a new DStream by applying a function to all elements of this DStream.
Parameters:
Name Type Attributes Description
func
bindArgs Array.<Object> <optional>
array whose values will be added to func's argument list.
Source:
Returns:
Type
module:eclairjs/streaming/dstream.PairDStream

persist(levelopt) → {module:eclairjs/streaming/dstream.DStream}

Persist RDDs of this DStream with the storage level
Parameters:
Name Type Attributes Description
level module:eclairjs/storage.StorageLevel <optional>
(MEMORY_ONLY_SER) by default
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

print() → {void}

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.
Source:
Returns:
Type
void

reduce(f) → {module:eclairjs/streaming/dstream.DStream}

Return a new DStream in which each RDD has a single element generated by reducing each RDD of this DStream.
Parameters:
Name Type Description
f func
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

reduceByWindow(reduceFunc, windowDuration, slideDuration) → {module:eclairjs/streaming/dstream.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.
Parameters:
Name Type Description
reduceFunc func associative reduce function
windowDuration module:eclairjs/streaming.Duration width of the window; must be a multiple of this DStream's batching interval
slideDuration module:eclairjs/streaming.Duration 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
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

reduceByWindowwithSlideDuration(reduceFunc, invReduceFunc, windowDuration, slideDuration) → {module:eclairjs/streaming/dstream.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 : 1. reduce the new values that entered the window (e.g., adding new counts) 2. "inverse reduce" the old values that left the window (e.g., subtracting old counts) This is more efficient than reduceByWindow without "inverse reduce" function. However, it is applicable to only "invertible reduce functions".
Parameters:
Name Type Description
reduceFunc func associative reduce function
invReduceFunc func inverse reduce function
windowDuration module:eclairjs/streaming.Duration width of the window; must be a multiple of this DStream's batching interval
slideDuration module:eclairjs/streaming.Duration 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
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

repartition(numPartitions) → {module:eclairjs/streaming/dstream.DStream}

Return a new DStream with an increased or decreased level of parallelism.
Parameters:
Name Type Description
numPartitions int
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

transform(transformFunc) → {module:eclairjs/streaming/dstream.DStream}

Return a new DStream in which each RDD is generated by applying a function on each RDD of 'this' DStream.
Parameters:
Name Type Description
transformFunc func
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

transformToPair(transformFunc) → {module:eclairjs/streaming/dstream.PairDStream}

Return a new DStream in which each RDD is generated by applying a function on each RDD of 'this' DStream.
Parameters:
Name Type Description
transformFunc func
Source:
Returns:
Type
module:eclairjs/streaming/dstream.PairDStream

union(that) → {module:eclairjs/streaming/dstream.DStream}

Return a new DStream by unifying data of another DStream with this DStream.
Parameters:
Name Type Description
that module:eclairjs/streaming/dstream.DStream
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream

window(duration, slideIntervalopt) → {module:eclairjs/streaming/dstream.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.
Parameters:
Name Type Attributes Description
duration width of the window; must be a multiple of this DStream's interval.
slideInterval <optional>
Source:
Returns:
Type
module:eclairjs/streaming/dstream.DStream