-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-19003][DOCS] Add Java example in Spark Streaming Guide, section Design Patterns for using foreachRDD #16408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
docs/streaming-programming-guide.md
Outdated
| <div data-lang="java" markdown="1"> | ||
| {% highlight java %} | ||
| dstream.foreachRDD(new VoidFunction<JavaRDD<String>>() { | ||
| @Override public void call(JavaRDD<String> rdd) throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits:
@Override
public ...
Don't throws Exception; remove or make more specific.
Extra space before new on next line.
docs/streaming-programming-guide.md
Outdated
| @Override public void call(JavaRDD<String> rdd) throws Exception { | ||
| rdd.foreach(new VoidFunction<String>() { | ||
| @Override public void call(String record) throws Exception { | ||
| Connection connection = new Connection(connectionString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this different from the Scala example?
docs/streaming-programming-guide.md
Outdated
| {% highlight java %} | ||
| dstream.foreachRDD(new VoidFunction<JavaRDD<String>>() { | ||
| @Override public void call(JavaRDD<String> rdd) throws Exception { | ||
| final Connection connection = new Connection(connectionString); // executed at the driver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why make this different from Scala?
|
Thanks @srowen for review and comments, made changes and committed on branch. |
|
Test build #3518 has finished for PR 16408 at commit
|
|
Merged to master/2.1 |
…n Design Patterns for using foreachRDD ## What changes were proposed in this pull request? Added missing Java example under section "Design Patterns for using foreachRDD". Now this section has examples in all 3 languages, improving consistency of documentation. ## How was this patch tested? Manual. Generated docs using command "SKIP_API=1 jekyll build" and verified generated HTML page manually. The syntax of example has been tested for correctness using sample code on Java1.7 and Spark 2.2.0-SNAPSHOT. Author: adesharatushar <[email protected]> Closes #16408 from adesharatushar/streaming-doc-fix. (cherry picked from commit dba81e1) Signed-off-by: Sean Owen <[email protected]>
…n Design Patterns for using foreachRDD ## What changes were proposed in this pull request? Added missing Java example under section "Design Patterns for using foreachRDD". Now this section has examples in all 3 languages, improving consistency of documentation. ## How was this patch tested? Manual. Generated docs using command "SKIP_API=1 jekyll build" and verified generated HTML page manually. The syntax of example has been tested for correctness using sample code on Java1.7 and Spark 2.2.0-SNAPSHOT. Author: adesharatushar <[email protected]> Closes apache#16408 from adesharatushar/streaming-doc-fix.
…n Design Patterns for using foreachRDD ## What changes were proposed in this pull request? Added missing Java example under section "Design Patterns for using foreachRDD". Now this section has examples in all 3 languages, improving consistency of documentation. ## How was this patch tested? Manual. Generated docs using command "SKIP_API=1 jekyll build" and verified generated HTML page manually. The syntax of example has been tested for correctness using sample code on Java1.7 and Spark 2.2.0-SNAPSHOT. Author: adesharatushar <[email protected]> Closes apache#16408 from adesharatushar/streaming-doc-fix.
What changes were proposed in this pull request?
Added missing Java example under section "Design Patterns for using foreachRDD". Now this section has examples in all 3 languages, improving consistency of documentation.
How was this patch tested?
Manual.
Generated docs using command "SKIP_API=1 jekyll build" and verified generated HTML page manually.
The syntax of example has been tested for correctness using sample code on Java1.7 and Spark 2.2.0-SNAPSHOT.