aboutsummaryrefslogtreecommitdiffstats
path: root/scald-mvp/src/main/scala/example
diff options
context:
space:
mode:
Diffstat (limited to 'scald-mvp/src/main/scala/example')
-rw-r--r--scald-mvp/src/main/scala/example/WordCount.scala23
1 files changed, 23 insertions, 0 deletions
diff --git a/scald-mvp/src/main/scala/example/WordCount.scala b/scald-mvp/src/main/scala/example/WordCount.scala
new file mode 100644
index 0000000..f7230c1
--- /dev/null
+++ b/scald-mvp/src/main/scala/example/WordCount.scala
@@ -0,0 +1,23 @@
+
+package example
+
+import com.twitter.scalding._
+
+object WordCountJob {
+
+ def main(args: Array[String]) {
+ (new WordCountJob(Args(List("--local", "", "--input", "dummy.txt", "--output", "dummy-out.txt")))).run
+
+ import io.Source
+ for (line <- Source.fromFile("dummy-out.txt").getLines())
+ println(line)
+ }
+}
+
+class WordCountJob(args : Args) extends Job(args) {
+ TypedPipe.from(TextLine(args("input")))
+ .flatMap { line => line.split("""\s+""") }
+ .groupBy { word => word }
+ .size
+ .write(TypedTsv(args("output")))
+}