You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by srowen <gi...@git.apache.org> on 2014/04/29 18:31:47 UTC

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

GitHub user srowen opened a pull request:

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

    SPARK-1663. Corrections for several compile errors in streaming code examples, and updates to follow API changes

    I gave the Streaming code examples, both Scala and Java, a test run today. I turned up a number of small errors, mostly compile errors in the Java examples. There were a few typos in the Scala too.
    
    I also took the liberty of adding things like imports, since in several cases they are not obvious. Feel free to push back on some changes.
    
    There's one thing I haven't quite addressed in the changes. `JavaPairDStream` uses the Java API version of `Function2` in almost all cases, as `JFunction2`. However it uses `scala.Function2` in:
    
    ```
      def reduceByKeyAndWindow(reduceFunc: Function2[V, V, V], windowDuration: Duration)
      :JavaPairDStream[K, V] = {
        dstream.reduceByKeyAndWindow(reduceFunc, windowDuration)
      }
    ```
    
    Is that a typo?
    
    Also, in Scala, I could not get this to compile:
    ```
    val windowedWordCounts = pairs.reduceByKeyAndWindow(_ + _, Seconds(30), Seconds(10))
    error: missing parameter type for expanded function ((x$1, x$2) => x$1.$plus(x$2))
    ```
    
    You can see my fix below but am I missing something?
    
    Otherwise I can say these all worked for me!

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

    $ git pull https://github.com/srowen/spark SPARK-1663

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

    https://github.com/apache/spark/pull/589.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 #589
    
----
commit 65a906b12d5ddea3235a676d19ceee2197c63bd7
Author: Sean Owen <so...@cloudera.com>
Date:   2014-04-29T16:24:20Z

    Corrections for several compile errors in streaming code examples, and updates to follow API changes

----


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

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

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

    https://github.com/apache/spark/pull/589#issuecomment-41704189
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14566/


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

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

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

    https://github.com/apache/spark/pull/589#issuecomment-41704140
  
    While using these methods we have to specify the parameter type for the reduceFunc.
    https://github.com/apache/spark/blob/master/streaming/src/main/scala/org/apache/spark/streaming/dstream/PairDStreamFunctions.scala#L295 
    https://github.com/apache/spark/blob/master/streaming/src/main/scala/org/apache/spark/streaming/dstream/PairDStreamFunctions.scala#L221


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

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

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

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


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

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

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

    https://github.com/apache/spark/pull/589#discussion_r12257762
  
    --- Diff: docs/streaming-programming-guide.md ---
    @@ -684,7 +694,7 @@ operation `reduceByKeyAndWindow`.
     
     {% highlight scala %}
     // Reduce last 30 seconds of data, every 10 seconds
    -val windowedWordCounts = pairs.reduceByKeyAndWindow(_ + _, Seconds(30), Seconds(10))
    +val windowedWordCounts = pairs.reduceByKeyAndWindow((a:Int,b:Int) => (a + b), Seconds(30), Seconds(10))
    --- End diff --
    
    Needs a space after the `,` - not a big deal I can fix on merge.



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

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

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

    https://github.com/apache/spark/pull/589#issuecomment-42114207
  
    @srowen these are all great - thanks! I'm going to merge it.
    
    For the reduceByKeyAndWindow issue, I think that's just an oversight that occurred during the Java 8 re-factoring, and just needs to be changed to `JFunction2`.
    
    For the compile error, this is a sort of weird corner case with method overloading in Scala. I think you'll need to specify a type signature for the reduce function.


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

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

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

    https://github.com/apache/spark/pull/589#issuecomment-41704188
  
    Merged build finished. All automated tests 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.
---

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

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

    https://github.com/apache/spark/pull/589#issuecomment-41699365
  
     Merged build triggered. 


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

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

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

    https://github.com/apache/spark/pull/589#issuecomment-42126543
  
    Sounds good @pwendell , thanks for merging with the comma fix.
    
    Should I open a separate issue for the `JFunction2` question?


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

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

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

    https://github.com/apache/spark/pull/589#issuecomment-41703565
  
    @srowen scala error is related to #550 


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

[GitHub] spark pull request: SPARK-1663. Corrections for several compile er...

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

    https://github.com/apache/spark/pull/589#issuecomment-41699381
  
    Merged build started. 


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