class SumLongs extends SerializableFunction[Iterable[Long], Long] {
override def apply(input: Iterable[Long]): Long = {
var sum = 0L
for (item <- input) {
sum += item
}
sum
}
}
It either complains that "too many arguments provided for perkey", or when I take that out, it states I'm missing parameter for OutputT.
Do you have a working example of Combine.perkey? I can't get combine per key to work. I can never get it to be correct in syntax.
Example - val sales: PCollection KV[(Int,Int), Long]
sales.apply(Combine.perKey[(Int,Int),Long,Long](new SumLongs()))
import org.apache.beam.sdk.transforms.SerializableFunction
class SumLongs extends SerializableFunction[Iterable[Long], Long] { override def apply(input: Iterable[Long]): Long = { var sum = 0L for (item <- input) { sum += item } sum } }
It either complains that "too many arguments provided for perkey", or when I take that out, it states I'm missing parameter for OutputT.
Thanks, Alistair