Closed jastice closed 11 years ago
Sorry about that. I've migrated a few examples in the documentation so that they can be compiled but not this one.
An easier fix is to use the Reduction.Sum.int
function directly:
import Reduction._
val counts = lines.flatMap(_.split("\\s"))
.map(word => (word, 1))
.groupByKey
.combine(Sum.int)
There are lots of other functions and combinators to build Reduction
objects when you need them. For example if you need to create a Reduction
which will work on a pair and do:
val red: Reduction[(Int, Int)] = Sum.int *** maximum // or Sum.int zip maximum
Okay, thanks for the extra info!
I copied the word count example from http://nicta.github.io/scoobi/guide-SNAPSHOT/guide/com.nicta.scoobi.guide.QuickStart.html#Write+your+code almost verbatim, but the line
.combine((a: Int, b: Int) => a + b)
will not compile, giving the error messagetype mismatch; found : (Int, Int) => Int required: com.nicta.scoobi.core.Reduction[?]
This works for me however: