Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,30 @@ sealed abstract class StateSpec[KeyType, ValueType, StateType, MappedType] exten

/**
* Set the RDD containing the initial states that will be used by `mapWithState`
*
* @return this `StateSpec` (to allow chaining)
*/
def initialState(rdd: RDD[(KeyType, StateType)]): this.type

/**
* Set the RDD containing the initial states that will be used by `mapWithState`
*
* @return this `StateSpec` (to allow chaining)
*/
def initialState(javaPairRDD: JavaPairRDD[KeyType, StateType]): this.type

/**
* Set the number of partitions by which the state RDDs generated by `mapWithState`
* will be partitioned. Hash partitioning will be used.
*
* @return this `StateSpec` (to allow chaining)
*/
def numPartitions(numPartitions: Int): this.type

/**
* Set the partitioner by which the state RDDs generated by `mapWithState` will be partitioned.
*
* @return this `StateSpec` (to allow chaining)
*/
def partitioner(partitioner: Partitioner): this.type

Expand All @@ -97,6 +105,8 @@ sealed abstract class StateSpec[KeyType, ValueType, StateType, MappedType] exten
* mapping function will be called one final time on the idle states that are going to be
* removed; [[org.apache.spark.streaming.State State.isTimingOut()]] set
* to `true` in that call.
*
* @return this `StateSpec` (to allow chaining)
*/
def timeout(idleDuration: Duration): this.type
}
Expand Down Expand Up @@ -153,6 +163,7 @@ object StateSpec {
* @tparam ValueType Class of the values
* @tparam StateType Class of the states data
* @tparam MappedType Class of the mapped data
* @return a new `StateSpec` for the `mapWithState` operation
*/
def function[KeyType, ValueType, StateType, MappedType](
mappingFunction: (Time, KeyType, Option[ValueType], State[StateType]) => Option[MappedType]
Expand All @@ -169,9 +180,11 @@ object StateSpec {
*
* @param mappingFunction The function applied on every data item to manage the associated state
* and generate the mapped data
* @tparam KeyType Class of the keys
* @tparam ValueType Class of the values
* @tparam StateType Class of the states data
* @tparam MappedType Class of the mapped data
* @return a new `StateSpec` for the `mapWithState` operation
*/
def function[KeyType, ValueType, StateType, MappedType](
mappingFunction: (KeyType, Option[ValueType], State[StateType]) => MappedType
Expand All @@ -196,6 +209,7 @@ object StateSpec {
* @tparam ValueType Class of the values
* @tparam StateType Class of the states data
* @tparam MappedType Class of the mapped data
* @return a new `StateSpec` for the `mapWithState` operation
*/
def function[KeyType, ValueType, StateType, MappedType](mappingFunction:
JFunction4[Time, KeyType, Optional[ValueType], State[StateType], Optional[MappedType]]):
Expand All @@ -218,9 +232,11 @@ object StateSpec {
*
* @param mappingFunction The function applied on every data item to manage the associated
* state and generate the mapped data
* @tparam KeyType Class of the keys
* @tparam ValueType Class of the values
* @tparam StateType Class of the states data
* @tparam MappedType Class of the mapped data
* @return a new `StateSpec` for the `mapWithState` operation
*/
def function[KeyType, ValueType, StateType, MappedType](
mappingFunction: JFunction3[KeyType, Optional[ValueType], State[StateType], MappedType]):
Expand Down