Hi, I'm trying to do a simple application in Flink Stream to count the top N words on a window-basis, but I don't know how to sort the words by their frequency in Flink.
In spark streaming, I would do something like this: « val isAscending = true stream.reduceByKeyAndWindow(reduceFunc, Seconds(10), Seconds (10)).transform(_.sortByKey(isAscending)).map(_._2) » How can I do it in Flink Stream? This is what I have so far: « val reduceFunc = (a: String, b: String) => { val aElems = a.split(Separator) val bElems = b.split(Separator) val result = a(params.aggParams.get.head.aggIndex).toInt + b(params.aggParams.get.head.aggIndex).toInt result.toString } stream.keyBy(0).timeWindow(Time.seconds(10), Time.seconds(10)).reduce(reduceFunc) » My stream is just a series of strings like "field1|field2|field3|..." Thanks.