Re: Count on grouped keys
Posted by
Punit Naik on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Count-on-grouped-keys-tp6575p6579.html
Anyways, I managed to do it. you should attach the following code block to your groupBy
.reduceGroup {
(in, out: org.apache.flink.util.Collector[(Map[String,String], Int)]) => // Map[String,String] is the data type I want to output along with the count as Int in a Tuple
var v:Int = 0;
var k:Map[String,String]=Map()
for (t <- in) {
v+=1;
k=t
}
out.collect((k,v))