aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorReza Zadeh <rizlar@gmail.com>2014-01-17 14:34:03 -0800
committerReza Zadeh <rizlar@gmail.com>2014-01-17 14:34:03 -0800
commitcaf97a25a2bd70ef5164c3ce0e8b59a8e39eb288 (patch)
tree3eaffca1eb0c9031c4f9acc2b91ea915beec25b1 /examples
parent4e96757793e7aee165381f80a60b3f46f60c9ebc (diff)
parentd749d472b37448edb322bc7208a3db925c9a4fc2 (diff)
downloadspark-caf97a25a2bd70ef5164c3ce0e8b59a8e39eb288.tar.gz
spark-caf97a25a2bd70ef5164c3ce0e8b59a8e39eb288.tar.bz2
spark-caf97a25a2bd70ef5164c3ce0e8b59a8e39eb288.zip
Merge remote-tracking branch 'upstream/master' into sparsesvd
Diffstat (limited to 'examples')
-rw-r--r--examples/pom.xml6
-rw-r--r--examples/src/main/scala/org/apache/spark/streaming/examples/NetworkWordCount.scala3
-rw-r--r--examples/src/main/scala/org/apache/spark/streaming/examples/StreamingExamples.scala17
3 files changed, 25 insertions, 1 deletions
diff --git a/examples/pom.xml b/examples/pom.xml
index cb4f7ee33b..7855706389 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -73,6 +73,12 @@
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
+ <artifactId>spark-graphx_${scala.binary.version}</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-twitter_${scala.binary.version}</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/examples/src/main/scala/org/apache/spark/streaming/examples/NetworkWordCount.scala b/examples/src/main/scala/org/apache/spark/streaming/examples/NetworkWordCount.scala
index 25f7013307..0226475712 100644
--- a/examples/src/main/scala/org/apache/spark/streaming/examples/NetworkWordCount.scala
+++ b/examples/src/main/scala/org/apache/spark/streaming/examples/NetworkWordCount.scala
@@ -19,6 +19,7 @@ package org.apache.spark.streaming.examples
import org.apache.spark.streaming.{Seconds, StreamingContext}
import org.apache.spark.streaming.StreamingContext._
+import org.apache.spark.storage.StorageLevel
/**
* Counts words in text encoded with UTF8 received from the network every second.
@@ -48,7 +49,7 @@ object NetworkWordCount {
// Create a NetworkInputDStream on target ip:port and count the
// words in input stream of \n delimited text (eg. generated by 'nc')
- val lines = ssc.socketTextStream(args(1), args(2).toInt)
+ val lines = ssc.socketTextStream(args(1), args(2).toInt, StorageLevel.MEMORY_ONLY_SER)
val words = lines.flatMap(_.split(" "))
val wordCounts = words.map(x => (x, 1)).reduceByKey(_ + _)
wordCounts.print()
diff --git a/examples/src/main/scala/org/apache/spark/streaming/examples/StreamingExamples.scala b/examples/src/main/scala/org/apache/spark/streaming/examples/StreamingExamples.scala
index d41d84a980..99f1502046 100644
--- a/examples/src/main/scala/org/apache/spark/streaming/examples/StreamingExamples.scala
+++ b/examples/src/main/scala/org/apache/spark/streaming/examples/StreamingExamples.scala
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.spark.streaming.examples
import org.apache.spark.Logging