Skip to content

Commit c143820

Browse files
Remis Haroonsrowen
authored andcommitted
[SPARK-21508][DOC] Fix example code provided in Spark Streaming Documentation
## What changes were proposed in this pull request? JIRA ticket : [SPARK-21508](https://issues.apache.org/jira/projects/SPARK/issues/SPARK-21508) correcting a mistake in example code provided in Spark Streaming Custom Receivers Documentation The example code provided in the documentation on 'Spark Streaming Custom Receivers' has an error. doc link : https://spark.apache.org/docs/latest/streaming-custom-receivers.html ``` // Assuming ssc is the StreamingContext val customReceiverStream = ssc.receiverStream(new CustomReceiver(host, port)) val words = lines.flatMap(_.split(" ")) ... ``` instead of `lines.flatMap(_.split(" "))` it should be `customReceiverStream.flatMap(_.split(" "))` ## How was this patch tested? this documentation change is tested manually by jekyll build , running below commands ``` jekyll build jekyll serve --watch ``` screen-shots provided below ![screenshot1](https://user-images.githubusercontent.com/8828470/28744636-a6de1ac6-7482-11e7-843b-ff84b5855ec0.png) ![screenshot2](https://user-images.githubusercontent.com/8828470/28744637-a6def496-7482-11e7-9512-7f4bbe027c6a.png) Author: Remis Haroon <[email protected]> Closes #18770 from remisharoon/master.
1 parent b56f79c commit c143820

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/streaming-custom-receivers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ an input DStream using data received by the instance of custom receiver, as show
175175
{% highlight scala %}
176176
// Assuming ssc is the StreamingContext
177177
val customReceiverStream = ssc.receiverStream(new CustomReceiver(host, port))
178-
val words = lines.flatMap(_.split(" "))
178+
val words = customReceiverStream.flatMap(_.split(" "))
179179
...
180180
{% endhighlight %}
181181

@@ -187,7 +187,7 @@ The full source code is in the example [CustomReceiver.scala]({{site.SPARK_GITHU
187187
{% highlight java %}
188188
// Assuming ssc is the JavaStreamingContext
189189
JavaDStream<String> customReceiverStream = ssc.receiverStream(new JavaCustomReceiver(host, port));
190-
JavaDStream<String> words = lines.flatMap(s -> ...);
190+
JavaDStream<String> words = customReceiverStream.flatMap(s -> ...);
191191
...
192192
{% endhighlight %}
193193

0 commit comments

Comments
 (0)