aboutsummaryrefslogtreecommitdiffstats
path: root/scalding/src/main/scala/example/WordCountJob.scala
diff options
context:
space:
mode:
Diffstat (limited to 'scalding/src/main/scala/example/WordCountJob.scala')
-rw-r--r--scalding/src/main/scala/example/WordCountJob.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/scalding/src/main/scala/example/WordCountJob.scala b/scalding/src/main/scala/example/WordCountJob.scala
new file mode 100644
index 0000000..0e63fed
--- /dev/null
+++ b/scalding/src/main/scala/example/WordCountJob.scala
@@ -0,0 +1,12 @@
+package example
+
+import com.twitter.scalding._
+
+class WordCountJob(args: Args) extends Job(args) {
+ TypedPipe.from(TextLine(args("input")))
+ .flatMap { line => line.split("\\s+") }
+ .map { word => (word, 1L) }
+ .sumByKey
+ // The compiler will enforce the type coming out of the sumByKey is the same as the type we have for our sink
+ .write(TypedTsv[(String, Long)](args("output")))
+}