You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by tdas <gi...@git.apache.org> on 2015/12/09 12:33:29 UTC

[GitHub] spark pull request: [WIP][SPARK-??][STREAMING] Renamed trackStateB...

GitHub user tdas opened a pull request:

    https://github.com/apache/spark/pull/10224

    [WIP][SPARK-??][STREAMING] Renamed trackStateByKey to mapWithState

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tdas/spark rename

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/10224.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #10224
    
----
commit 68d1c64cf162332a64532e7f7ba20ad2b4187381
Author: Tathagata Das <ta...@gmail.com>
Date:   2015-12-09T11:32:37Z

    Renamed trackStateByKey to mapWithState

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163486767
  
    merging to master and 1.6


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-??][STREAMING] Renamed trackStateB...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163220734
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/47426/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163403094
  
    **[Test build #47449 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47449/consoleFull)** for PR 10224 at commit [`4e9f778`](https://github.com/apache/spark/commit/4e9f77840bf51a4e2282b7b546495c411829c332).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][STREAMING] Rename trackStateByKe...

Posted by tdas <gi...@git.apache.org>.
Github user tdas commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163386533
  
    yeah. I am doing that. I havent updated the tests yet.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163430564
  
    **[Test build #47447 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47447/consoleFull)** for PR 10224 at commit [`13b8cb4`](https://github.com/apache/spark/commit/13b8cb42afbf9e03a65e614ba6d23f0831d8017b).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163430724
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by tdas <gi...@git.apache.org>.
Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10224#discussion_r47154876
  
    --- Diff: streaming/src/main/scala/org/apache/spark/streaming/StateSpec.scala ---
    @@ -91,92 +96,93 @@ sealed abstract class StateSpec[KeyType, ValueType, StateType, EmittedType] exte
     /**
      * :: Experimental ::
      * Builder object for creating instances of [[org.apache.spark.streaming.StateSpec StateSpec]]
    - * that is used for specifying the parameters of the DStream transformation `trackStateByKey`
    + * that is used for specifying the parameters of the DStream transformation `mapWithState`
      * that is used for specifying the parameters of the DStream transformation
    - * `trackStateByKey` operation of a
    + * `mapWithState` operation of a
      * [[org.apache.spark.streaming.dstream.PairDStreamFunctions pair DStream]] (Scala) or a
      * [[org.apache.spark.streaming.api.java.JavaPairDStream JavaPairDStream]] (Java).
      *
      * Example in Scala:
      * {{{
    - *    def trackingFunction(data: Option[ValueType], wrappedState: State[StateType]): EmittedType = {
    + *    def mappingFunction(data: Option[ValueType], wrappedState: State[StateType]): MappedType = {
      *      ...
      *    }
      *
    - *    val emittedRecordDStream = keyValueDStream.trackStateByKey[StateType, EmittedDataType](
    - *        StateSpec.function(trackingFunction).numPartitions(10))
    + *    val spec = StateSpec.function(mappingFunction).numPartitions(10)
    --- End diff --
    
    I am modifying the signature of the function to have the key. See jira SPARK-12245. So then this should not be a problem.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163459519
  
    **[Test build #47467 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47467/consoleFull)** for PR 10224 at commit [`6d29b7a`](https://github.com/apache/spark/commit/6d29b7a69c81f19b241a6b0202ddd07b990fd508).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163448162
  
    Merged build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163478287
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163448106
  
    Merged build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10224#discussion_r47173727
  
    --- Diff: streaming/src/main/scala/org/apache/spark/streaming/api/java/JavaPairDStream.scala ---
    @@ -430,42 +430,37 @@ class JavaPairDStream[K, V](val dstream: DStream[(K, V)])(
     
       /**
        * :: Experimental ::
    -   * Return a new [[JavaDStream]] of data generated by combining the key-value data in `this` stream
    -   * with a continuously updated per-key state. The user-provided state tracking function is
    -   * applied on each keyed data item along with its corresponding state. The function can choose to
    -   * update/remove the state and return a transformed data, which forms the
    -   * [[JavaTrackStateDStream]].
    +   * Return a [[JavaMapWithStateDStream]] by applying a function to every key-value element of
    +   * `this` stream, while maintaining some state data for each unique key. The mapping function
    +   * and other specification (e.g. partitioners, timeouts, initial state data, etc.) of this
    +   * transformation can be specified using [[StateSpec]] class. The state data is accessible in
    +   * as a parameter of type [[State]] in the mapping function.
        *
    -   * The specifications of this transformation is made through the
    -   * [[org.apache.spark.streaming.StateSpec StateSpec]] class. Besides the tracking function, there
    -   * are a number of optional parameters - initial state data, number of partitions, timeouts, etc.
    -   * See the [[org.apache.spark.streaming.StateSpec StateSpec]] for more details.
    -   *
    -   * Example of using `trackStateByKey`:
    +   * Example of using `mapWithState`:
        * {{{
    -   *   // A tracking function that maintains an integer state and return a String
    -   *   Function2<Optional<Integer>, State<Integer>, Optional<String>> trackStateFunc =
    -   *       new Function2<Optional<Integer>, State<Integer>, Optional<String>>() {
    -   *
    -   *         @Override
    -   *         public Optional<String> call(Optional<Integer> one, State<Integer> state) {
    -   *           // Check if state exists, accordingly update/remove state and return transformed data
    -   *         }
    +   *   // A mapping function that maintains an integer state and return a string
    +   *   Function3<String, Optional<Integer>, State<Integer>, String> mappingFunction =
    +   *       new Function3<String, Optional<Integer>, State<Integer>, String>() {
    +   *           @Override
    +   *           public Optional<String> call(Optional<Integer> value, State<Integer> state) {
    +   *               // Use state.exists(), state.get(), state.update() and state.remove()
    +   *               // to manage state, and return the necessary string
    +   *           }
        *       };
        *
    -   *    JavaTrackStateDStream<Integer, Integer, Integer, String> trackStateDStream =
    -   *        keyValueDStream.<Integer, String>trackStateByKey(
    -   *                 StateSpec.function(trackStateFunc).numPartitions(10));
    +   *    JavaMapWithStateDStream<Integer, Integer, Integer, String> mapWithStateDStream =
    --- End diff --
    
    nit: the key type is `String` now.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163478224
  
    **[Test build #47467 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47467/consoleFull)** for PR 10224 at commit [`6d29b7a`](https://github.com/apache/spark/commit/6d29b7a69c81f19b241a6b0202ddd07b990fd508).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163478288
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/47467/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163446479
  
    **[Test build #2191 has started](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/2191/consoleFull)** for PR 10224 at commit [`495b982`](https://github.com/apache/spark/commit/495b982c58292b9a5c2ccec338835cd0bfd623a9).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][STREAMING] Rename trackStateByKe...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10224#discussion_r47154432
  
    --- Diff: streaming/src/main/scala/org/apache/spark/streaming/StateSpec.scala ---
    @@ -91,92 +96,93 @@ sealed abstract class StateSpec[KeyType, ValueType, StateType, EmittedType] exte
     /**
      * :: Experimental ::
      * Builder object for creating instances of [[org.apache.spark.streaming.StateSpec StateSpec]]
    - * that is used for specifying the parameters of the DStream transformation `trackStateByKey`
    + * that is used for specifying the parameters of the DStream transformation `mapWithState`
      * that is used for specifying the parameters of the DStream transformation
    - * `trackStateByKey` operation of a
    + * `mapWithState` operation of a
      * [[org.apache.spark.streaming.dstream.PairDStreamFunctions pair DStream]] (Scala) or a
      * [[org.apache.spark.streaming.api.java.JavaPairDStream JavaPairDStream]] (Java).
      *
      * Example in Scala:
      * {{{
    - *    def trackingFunction(data: Option[ValueType], wrappedState: State[StateType]): EmittedType = {
    + *    def mappingFunction(data: Option[ValueType], wrappedState: State[StateType]): MappedType = {
      *      ...
      *    }
      *
    - *    val emittedRecordDStream = keyValueDStream.trackStateByKey[StateType, EmittedDataType](
    - *        StateSpec.function(trackingFunction).numPartitions(10))
    + *    val spec = StateSpec.function(mappingFunction).numPartitions(10)
    --- End diff --
    
    I remember this line cannot be put here because the compiler cannot infer `KeyType`.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163484372
  
    LGTM


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-??][STREAMING] Renamed trackStateB...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163198867
  
    **[Test build #47426 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47426/consoleFull)** for PR 10224 at commit [`68d1c64`](https://github.com/apache/spark/commit/68d1c64cf162332a64532e7f7ba20ad2b4187381).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163448164
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/47460/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163430726
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/47447/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10224#discussion_r47173816
  
    --- Diff: streaming/src/main/scala/org/apache/spark/streaming/StateSpec.scala ---
    @@ -91,115 +105,125 @@ sealed abstract class StateSpec[KeyType, ValueType, StateType, EmittedType] exte
     /**
      * :: Experimental ::
      * Builder object for creating instances of [[org.apache.spark.streaming.StateSpec StateSpec]]
    - * that is used for specifying the parameters of the DStream transformation `trackStateByKey`
    + * that is used for specifying the parameters of the DStream transformation `mapWithState`
      * that is used for specifying the parameters of the DStream transformation
    - * `trackStateByKey` operation of a
    + * `mapWithState` operation of a
      * [[org.apache.spark.streaming.dstream.PairDStreamFunctions pair DStream]] (Scala) or a
      * [[org.apache.spark.streaming.api.java.JavaPairDStream JavaPairDStream]] (Java).
      *
      * Example in Scala:
      * {{{
    - *    def trackingFunction(data: Option[ValueType], wrappedState: State[StateType]): EmittedType = {
    - *      ...
    + *    // A mapping function that maintains an integer state and return a String
    + *    def mappingFunction(key: String, value: Option[Int], state: State[Int]): Option[String] = {
    + *      // Use state.exists(), state.get(), state.update() and state.remove()
    + *      // to manage state, and return the necessary string
      *    }
      *
    - *    val emittedRecordDStream = keyValueDStream.trackStateByKey[StateType, EmittedDataType](
    - *        StateSpec.function(trackingFunction).numPartitions(10))
    + *    val spec = StateSpec.function(mappingFunction).numPartitions(10)
    + *
    + *    val mapWithStateDStream = keyValueDStream.mapWithState[StateType, MappedType](spec)
      * }}}
      *
      * Example in Java:
      * {{{
    - *    StateSpec<KeyType, ValueType, StateType, EmittedDataType> spec =
    - *      StateSpec.<KeyType, ValueType, StateType, EmittedDataType>function(trackingFunction)
    - *                    .numPartition(10);
    + *   // A mapping function that maintains an integer state and return a string
    + *   Function3<String, Optional<Integer>, State<Integer>, String> mappingFunction =
    + *       new Function3<String, Optional<Integer>, State<Integer>, String>() {
    + *           @Override
    + *           public Optional<String> call(Optional<Integer> value, State<Integer> state) {
    + *               // Use state.exists(), state.get(), state.update() and state.remove()
    + *               // to manage state, and return the necessary string
    + *           }
    + *       };
      *
    - *    JavaTrackStateDStream<KeyType, ValueType, StateType, EmittedType> emittedRecordDStream =
    - *      javaPairDStream.<StateType, EmittedDataType>trackStateByKey(spec);
    + *    JavaMapWithStateDStream<Integer, Integer, Integer, String> mapWithStateDStream =
    --- End diff --
    
    nit: the key type is `Integer` now


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][STREAMING] Rename trackStateByKe...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163386180
  
    Could you search `trackState` in the project and fix other places?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163404811
  
    **[Test build #47449 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47449/consoleFull)** for PR 10224 at commit [`4e9f778`](https://github.com/apache/spark/commit/4e9f77840bf51a4e2282b7b546495c411829c332).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163446547
  
    **[Test build #47460 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47460/consoleFull)** for PR 10224 at commit [`6f5c694`](https://github.com/apache/spark/commit/6f5c6949021ae9e12091dbf205e41e5ad0240159).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-??][STREAMING] Renamed trackStateB...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163220729
  
    Merged build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163447593
  
    **[Test build #2191 has finished](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/2191/consoleFull)** for PR 10224 at commit [`495b982`](https://github.com/apache/spark/commit/495b982c58292b9a5c2ccec338835cd0bfd623a9).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10224#discussion_r47154844
  
    --- Diff: streaming/src/main/scala/org/apache/spark/streaming/dstream/PairDStreamFunctions.scala ---
    @@ -352,39 +352,36 @@ class PairDStreamFunctions[K, V](self: DStream[(K, V)])
     
       /**
        * :: Experimental ::
    -   * Return a new DStream of data generated by combining the key-value data in `this` stream
    -   * with a continuously updated per-key state. The user-provided state tracking function is
    -   * applied on each keyed data item along with its corresponding state. The function can choose to
    -   * update/remove the state and return a transformed data, which forms the
    -   * [[org.apache.spark.streaming.dstream.TrackStateDStream]].
    +   * Return a [[MapWithStateDStream]] by applying a function to every key-value element of
    +   * `this` stream, while maintaining some state data for each unique key. The mapping function
    +   * and other specification (e.g. partitioners, timeouts, initial state data, etc.) of this
    +   * transformation can be specified using [[StateSpec]] class. The state data is accessible in
    +   * as a parameter of type [[State]] in the mapping function.
        *
    -   * The specifications of this transformation is made through the
    -   * [[org.apache.spark.streaming.StateSpec StateSpec]] class. Besides the tracking function, there
    -   * are a number of optional parameters - initial state data, number of partitions, timeouts, etc.
    -   * See the [[org.apache.spark.streaming.StateSpec StateSpec spec docs]] for more details.
    -   *
    -   * Example of using `trackStateByKey`:
    +   * Example of using `mapWithState`:
        * {{{
    -   *    def trackingFunction(data: Option[Int], wrappedState: State[Int]): String = {
    -   *      // Check if state exists, accordingly update/remove state and return transformed data
    +   *    // A mapping function that maintains an integer state and return a string
    +   *    def mappingFunction(data: Option[Int], wrappedState: State[Int]): String = {
    +   *          // Use state.exists(), state.get(), state.update() and state.remove()
    +   *          // to manage state, and return the necessary string
        *    }
        *
    -   *    val spec = StateSpec.function(trackingFunction).numPartitions(10)
    +   *    val spec = StateSpec.function(mappingFunction).numPartitions(10)
    --- End diff --
    
    Same issue as above


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163448158
  
    **[Test build #47460 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47460/consoleFull)** for PR 10224 at commit [`6f5c694`](https://github.com/apache/spark/commit/6f5c6949021ae9e12091dbf205e41e5ad0240159).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][STREAMING] Rename trackStateByKe...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10224#discussion_r47153930
  
    --- Diff: extras/java8-tests/src/test/java/org/apache/spark/streaming/Java8APISuite.java ---
    @@ -867,8 +865,8 @@ public void testTrackStateByAPI() {
         JavaPairRDD<String, Boolean> initialRDD = null;
    --- End diff --
    
    nit: the method name `testTrackStateByAPI` should be renamed to `testMapWithStateAPI`


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163448107
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/47458/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163404823
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/47449/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [WIP][SPARK-??][STREAMING] Renamed trackStateB...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163220578
  
    **[Test build #47426 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47426/consoleFull)** for PR 10224 at commit [`68d1c64`](https://github.com/apache/spark/commit/68d1c64cf162332a64532e7f7ba20ad2b4187381).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/10224


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163404821
  
    Merged build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][STREAMING] Rename trackStateByKe...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163395341
  
    **[Test build #47447 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47447/consoleFull)** for PR 10224 at commit [`13b8cb4`](https://github.com/apache/spark/commit/13b8cb42afbf9e03a65e614ba6d23f0831d8017b).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on the pull request:

    https://github.com/apache/spark/pull/10224#issuecomment-163445177
  
    LGTM except some nits


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12244][SPARK-12245][STREAMING] Rename t...

Posted by zsxwing <gi...@git.apache.org>.
Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10224#discussion_r47173853
  
    --- Diff: streaming/src/main/scala/org/apache/spark/streaming/StateSpec.scala ---
    @@ -37,50 +37,64 @@ import org.apache.spark.{HashPartitioner, Partitioner}
      *
      * Example in Scala:
      * {{{
    - *    def trackingFunction(data: Option[ValueType], wrappedState: State[StateType]): EmittedType = {
    - *      ...
    + *    // A mapping function that maintains an integer state and return a String
    + *    def mappingFunction(key: String, value: Option[Int], state: State[Int]): Option[String] = {
    + *      // Use state.exists(), state.get(), state.update() and state.remove()
    + *      // to manage state, and return the necessary string
      *    }
      *
    - *    val spec = StateSpec.function(trackingFunction).numPartitions(10)
    + *    val spec = StateSpec.function(mappingFunction).numPartitions(10)
      *
    - *    val emittedRecordDStream = keyValueDStream.trackStateByKey[StateType, EmittedDataType](spec)
    + *    val mapWithStateDStream = keyValueDStream.mapWithState[StateType, MappedType](spec)
      * }}}
      *
      * Example in Java:
      * {{{
    - *    StateSpec<KeyType, ValueType, StateType, EmittedDataType> spec =
    - *      StateSpec.<KeyType, ValueType, StateType, EmittedDataType>function(trackingFunction)
    - *                    .numPartition(10);
    + *   // A mapping function that maintains an integer state and return a string
    + *   Function3<String, Optional<Integer>, State<Integer>, String> mappingFunction =
    + *       new Function3<String, Optional<Integer>, State<Integer>, String>() {
    + *           @Override
    + *           public Optional<String> call(Optional<Integer> value, State<Integer> state) {
    + *               // Use state.exists(), state.get(), state.update() and state.remove()
    + *               // to manage state, and return the necessary string
    + *           }
    + *       };
      *
    - *    JavaTrackStateDStream<KeyType, ValueType, StateType, EmittedType> emittedRecordDStream =
    - *      javaPairDStream.<StateType, EmittedDataType>trackStateByKey(spec);
    + *    JavaMapWithStateDStream<Integer, Integer, Integer, String> mapWithStateDStream =
    --- End diff --
    
    nit: the key type is `String`


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org