開發者學堂課程【大資料實時計算架構 Spark 快速入門:Spark textFile 和排序-3】學習筆記,與課程緊密聯系,讓使用者快速學習知識。
課程位址:
https://developer.aliyun.com/learning/course/100/detail/1696Spark textFile 和排序-3
GroupTopN 相關代碼
47@override
48publie Stcing call(Tuple2>tuple)
49throws Exception {
50return tuple._ 1;
51}
52}).collect();
53
54groupedPairs.filter(new Function>, Boolean>() {
55
56private static final long serialVersionUID =1L;
57
58@Override
59public Boolean call(Tuple2>tuple)
60throws Exception {
61return tuple._1. equals(keys.get(0));
62
63}).flatMap(new FlatMapFunctionsTuple> Integer>(){
64});
65
66JavaPairRDD>top2score=groupedPairs
67.mapToPair(new PairFunction>,String, Iterable>() {
68
69private static final long serialVersionUID1L;