File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ main entry point for all streaming functionality. We create a local StreamingCon
6666{% highlight scala %}
6767import org.apache.spark._
6868import org.apache.spark.streaming._
69+ import org.apache.spark.streaming.StreamingContext._ // not necessary in Spark 1.3+
6970
7071// Create a local StreamingContext with two working thread and batch interval of 1 second.
7172// The master requires 2 cores to prevent from a starvation scenario.
@@ -97,6 +98,7 @@ each line will be split into multiple words and the stream of words is represent
9798` words ` DStream. Next, we want to count these words.
9899
99100{% highlight scala %}
101+ import org.apache.spark.streaming.StreamingContext._ // not necessary in Spark 1.3+
100102// Count each word in each batch
101103val pairs = words.map(word => (word, 1))
102104val wordCounts = pairs.reduceByKey(_ + _ )
You can’t perform that action at this time.
0 commit comments