简体   繁体   中英

Apache Flink - groupBy

I am trying to follow the first exercise on http://dataartisans.github.io/flink-training/exercises/ .

Now I come to the following problem. What does the groupBy function give me back? And how does the foldLeft method transform that - for me unknown - result?

The code is the following:

mails.map {
          m => (m._1.substring(0, 7), m._2.substring(m._2.lastIndexOf("<") + 1, m._2.length - 1))
        }
        .groupBy(0, 1)
        .reduceGroup( ms => ms.foldLeft("", "", 0)( (c, m) => (m._1, m._2, c._3 + 1) ) )

Regards, Kevin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM