diff options
author | Bryan Newbold <bnewbold@archive.org> | 2018-05-23 12:27:59 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2018-05-24 00:02:36 -0700 |
commit | 4ba428db30593b67283dd90b92141f99840dc78e (patch) | |
tree | f63c8e146e7f90a530abfebdb993ab45d57426d5 /scalding/src/main/scala/example/WordCountJob.scala | |
parent | 29e4a83ff76da07bc6ad5d3f49d746ee0bc72023 (diff) | |
download | sandcrawler-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.scala | 12 |
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"))) +} |