From 41a822232d5f18433ab9f84d9a5c5971a1d8d6a6 Mon Sep 17 00:00:00 2001 From: Christophe Billiard Date: Thu, 13 Aug 2015 13:11:43 +0200 Subject: [PATCH] Updated Play to 2.3.4 and Spark to 1.4.0 (and sbt to 0.13.7 and scala to 2.11.6) --- app/utils/SparkSQL.scala | 9 ++++----- build.sbt | 21 ++++++++++++++------- project/build.properties | 2 +- project/plugins.sbt | 2 +- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/app/utils/SparkSQL.scala b/app/utils/SparkSQL.scala index 9e45e80..8a93d92 100644 --- a/app/utils/SparkSQL.scala +++ b/app/utils/SparkSQL.scala @@ -23,16 +23,15 @@ object SparkSQL { val sqlContext = new SQLContext(sc) - import sqlContext._ + import sqlContext.implicits._ - val wordCount = words.map(word => (word,1)).reduceByKey(_+_).map(wc => WordCount(wc._1, wc._2)) - wordCount.registerAsTable("wordCount") + val wordCount = words.map(word => (word,1)).reduceByKey(_+_).map(wc => WordCount(wc._1, wc._2)).toDF() - val moreThanTenCounters = wordCount.where('count > 10).select('word) + val moreThanTenCounters = wordCount.where(wordCount("count") > 10).select(wordCount("word")) println("Words occuring more than 10 times are : ") moreThanTenCounters.map(mttc => "Word : " + mttc(0)).collect().foreach(println) } -} \ No newline at end of file +} diff --git a/build.sbt b/build.sbt index 10e1173..6d701af 100644 --- a/build.sbt +++ b/build.sbt @@ -2,16 +2,23 @@ name := "firstSparkApp" version := "1.0-SNAPSHOT" +scalaVersion := "2.11.6" + +lazy val root = (project in file(".")).enablePlugins(PlayScala) + +val sparkVersion = "1.4.0" +val playVersion = "2.3.4" + libraryDependencies ++= Seq( jdbc, anorm, cache, - "org.apache.spark" %% "spark-core" % "1.0.1", - "com.typesafe.akka" %% "akka-actor" % "2.2.3", - "com.typesafe.akka" %% "akka-slf4j" % "2.2.3", - "org.apache.spark" %% "spark-streaming-twitter" % "1.0.1", - "org.apache.spark" %% "spark-sql" % "1.0.1", - "org.apache.spark" %% "spark-mllib" % "1.0.1" + "org.apache.spark" %% "spark-core" % sparkVersion, + "com.typesafe.akka" %% "akka-actor" % playVersion, + "com.typesafe.akka" %% "akka-slf4j" % playVersion, + "org.apache.spark" %% "spark-streaming-twitter" % sparkVersion, + "org.apache.spark" %% "spark-sql" % sparkVersion, + "org.apache.spark" %% "spark-mllib" % sparkVersion ) -play.Project.playScalaSettings + diff --git a/project/build.properties b/project/build.properties index 0974fce..748703f 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.0 +sbt.version=0.13.7 diff --git a/project/plugins.sbt b/project/plugins.sbt index e1aef47..8237e93 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,4 +5,4 @@ logLevel := Level.Warn resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // Use the Play sbt plugin for Play projects -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0") \ No newline at end of file +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.4")