forked from pranab/beymani
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pranab Ghosh
committed
Oct 7, 2014
1 parent
60250b8
commit 5b0fb5a
Showing
5 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import sbtassembly.{Plugin},Plugin.AssemblyKeys._ | ||
import sbtassembly.Plugin._ | ||
|
||
name := "beymani" | ||
|
||
organization := "org.beymani" | ||
|
||
version := "1.0" | ||
|
||
scalaVersion := "2.10.4" | ||
|
||
libraryDependencies ++=Seq( | ||
"org.apache.spark" %% "spark-core" % "1.1.0" % "provided", | ||
"org.apache.spark" %% "spark-streaming" % "1.1.0", | ||
"org.apache.spark" %% "spark-streaming-kafka" % "1.1.0", | ||
"org.apache.commons" % "commons-lang3" % "3.0", | ||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.3.3", | ||
"com.fasterxml.jackson.module" % "jackson-module-scala_2.10" % "2.3.3", | ||
"junit" % "junit" % "4.7" % "test", | ||
"org.scalatest" % "scalatest_2.10" % "2.0" % "test" | ||
) | ||
|
||
net.virtualvoid.sbt.graph.Plugin.graphSettings | ||
|
||
assemblySettings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=0.13.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
logLevel := Level.Warn | ||
|
||
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4") | ||
|
||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2") | ||
|
||
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0") | ||
|
||
resolvers ++= Seq( | ||
"Cloudera Repository" at "https://repository.cloudera.com/artifactory/cloudera-repos/", | ||
"Akka Repository" at "http://repo.akka.io/releases/", | ||
"scala-tools" at "https://oss.sonatype.org/content/groups/scala-tools" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.beymani.sanity | ||
|
||
import org.apache.spark._ | ||
import org.apache.spark.SparkContext._ | ||
|
||
object WordCount { | ||
def main(args: Array[String]) { | ||
val master = args.length match { | ||
case x: Int if x > 0 => args(0) | ||
case _ => "local" | ||
} | ||
val sc = new SparkContext(master, "WordCount", System.getenv("SPARK_HOME")) | ||
val input = args.length match { | ||
case x: Int if x > 1 => sc.textFile(args(1)) | ||
case _ => sc.parallelize(List("pandas", "i like pandas")) | ||
} | ||
val words = input.flatMap(line => line.split(" ")) | ||
args.length match { | ||
case x: Int if x > 2 => { | ||
val counts = words.map(word => (word, 1)).reduceByKey{case (x,y) => x + y} | ||
counts.saveAsTextFile(args(2)) | ||
} | ||
case _ => { | ||
val wc = words.countByValue() | ||
println(wc.mkString(",")) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version in ThisBuild := "1.0-SNAPSHOT" |