I'd just like to have a quick look to Hadoop's word-count example, if it can be written in Groovy.
Disclaimer: this code doesn't work !
class WordCountMapReduce {
def map = {key, value, output, reporter ->
def line = value.toString()
def itr = new StringTokenizer(line)
while(itr.hasMoreTokens()) {
word.set(itr.nextToken())
output.collect(word, one)
}
}
def reduce = {key, values, output, reporter ->
int sum = 0;
values.each {
sum += it.get()
}
output.collect(key, sum)
}
}
It's time for Groovy to go fore massive computation?