aboutsummaryrefslogtreecommitdiffstats
path: root/scalding/src/main/scala/example/WordCountJob.scala
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2018-05-23 12:27:59 -0700
committerBryan Newbold <bnewbold@archive.org>2018-05-24 00:02:36 -0700
commit4ba428db30593b67283dd90b92141f99840dc78e (patch)
treef63c8e146e7f90a530abfebdb993ab45d57426d5 /scalding/src/main/scala/example/WordCountJob.scala
parent29e4a83ff76da07bc6ad5d3f49d746ee0bc72023 (diff)
downloadsandcrawler-4ba428db30593b67283dd90b92141f99840dc78e.tar.gz
sandcrawler-4ba428db30593b67283dd90b92141f99840dc78e.zip
rename jvm/scalding directories
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")))
+}