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 <[email protected]>
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to