scala - Apache Flink - groupBy -
i trying follow first exercise on http://dataartisans.github.io/flink-training/exercises/.
now come following problem. groupby
function give me back? , how foldleft
method transform - me unknown - result?
the code 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
groupby
returns grouped data set: https://ci.apache.org/projects/flink/flink-docs-release-1.0/apis/batch/dataset_transformations.html#groupreduce-on-grouped-dataset
foldleft
defines folding (or reducing) order. see here: https://en.wikipedia.org/wiki/fold_%28higher-order_function%29
Comments
Post a Comment