Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/2267#discussion_r17101578
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/dstream/PairDStreamFunctions.scala
---
@@ -396,6 +396,26 @@ class PairDStreamFunctions[K, V](self: DStream[(K,V)])
/**
* Return a new "state" DStream where the state for each key is updated
by applying
+ * the given function on the previous state of the key and the new
values of the key.
+ * org.apache.spark.Partitioner is used to control the partitioning of
each RDD.
+ * @param updateFunc State update function. If `this` function returns
None, then
+ * corresponding state key-value pair will be
eliminated.
+ * @param partitioner Partitioner for controlling the partitioning of
each RDD in the new
+ * DStream.
+ * @tparam S State type
+ */
+ def updateStateByKey[S: ClassTag](
+ updateFunc: (Time, K, Seq[V], Option[S]) => Option[S],
+ partitioner: Partitioner
+ ): DStream[(K, S)] = {
+ val newUpdateFunc = (time: Time, iterator: Iterator[(K, Seq[V],
Option[S])]) => {
--- End diff --
The existing method could call the new method rather than duplicate the
logic. If the user supplies a function with Seq[V], Option[S] as args, that can
be made into a function that also accepts and does nothing with Time.
What's the use case for this though?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]