aboutsummaryrefslogtreecommitdiffstats
path: root/scalding/src/main/scala/example/WordCountJob.scala
blob: 0e63fedabd4c7b772621bc66ceded8d0857996a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
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")))
}