Skip to content
Snippets Groups Projects
Commit 4e2c9653 authored by Andrew Ash's avatar Andrew Ash
Browse files

Don't use deprecated Application in example

As of 2.9.0 extending from Application is not recommended

http://www.scala-lang.org/api/2.9.3/index.html#scala.Application
parent bc36ee4f
No related branches found
No related tags found
No related merge requests found
...@@ -111,14 +111,16 @@ We'll create a very simple Spark job in Scala. So simple, in fact, that it's nam ...@@ -111,14 +111,16 @@ We'll create a very simple Spark job in Scala. So simple, in fact, that it's nam
import spark.SparkContext import spark.SparkContext
import SparkContext._ import SparkContext._
object SimpleJob extends Application { object SimpleJob {
val logFile = "/var/log/syslog" // Should be some file on your system def main(args: Array[String]) {
val sc = new SparkContext("local", "Simple Job", "$YOUR_SPARK_HOME", val logFile = "/var/log/syslog" // Should be some file on your system
List("target/scala-{{site.SCALA_VERSION}}/simple-project_{{site.SCALA_VERSION}}-1.0.jar")) val sc = new SparkContext("local", "Simple Job", "$YOUR_SPARK_HOME",
val logData = sc.textFile(logFile, 2).cache() List("target/scala-{{site.SCALA_VERSION}}/simple-project_{{site.SCALA_VERSION}}-1.0.jar"))
val numAs = logData.filter(line => line.contains("a")).count() val logData = sc.textFile(logFile, 2).cache()
val numBs = logData.filter(line => line.contains("b")).count() val numAs = logData.filter(line => line.contains("a")).count()
println("Lines with a: %s, Lines with b: %s".format(numAs, numBs)) val numBs = logData.filter(line => line.contains("b")).count()
println("Lines with a: %s, Lines with b: %s".format(numAs, numBs))
}
} }
{% endhighlight %} {% endhighlight %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment