Last active
December 17, 2015 19:39
-
-
Save samklr/5662343 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class WordCountJob(args : Args) extends Job(args) { | |
| TextLine( args("input") ) | |
| .flatMap('line -> 'word) { line : String => tokenize(line) } | |
| .groupBy('word) { _.size } | |
| .write( Tsv( args("output") ) ) | |
| } | |
| BECOMES | |
| class WordCountJob(args: Args) extends Job(args) { | |
| val lines : TypedPipe[String] = TextLine(args("input")) | |
| val words = lines.flatMap('line -> 'word) { line => line.split("\\s+") | |
| val groupedWord = words.groupBy(identity) | |
| val countedWords = groupedWord.size | |
| countedWords.write(TypedTsv[(String,Long)](args("output"))) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment