<强> 强>
<强> 强>
spu-1 1
spu-1 2
spu-2 3
spu-2 4
spu-3 5
spu-3 6
spu-1 7
spu-4 8
spu-4 9
spu-1 8
- <李>
李>
- <李>
李>
- <李>
- <李>
李>
@Override public int  compareTo (Cate2SpuKey ), { System.out.println(“开始对关键进行排序…”); 如果(cate2.equals (that.getCate2 ())) { return spu.compareTo (that.getSpu ()); } return cate2.compareTo (that.getCate2 ()); }
- <李>
<强> 强>
李>
- <李>
<强> 强>
李>
@Override protected void 减少(Cate2CountsKey 关键,,Iterable,价值观, Reducer .Context 上下文) throws IOException, InterruptedException { System.out.println(“减少…”); System.out.println(“价值观迭代前……,关键:“,+,key.toString ()); System.out.println(“价值观迭代前……,关键:“,+,key.getCounts ()); int top =, 3; (Text t :值){ 如果(top 祝辞,0){ System.out.println(“价值观迭代中……,关键:“,+,key.toString ()); System.out.println(“价值观迭代中……,关键:“,+,key.getCounts ()); context.write (new 文本(key.getCate2 (), +,“t \”, +, t.toString ()),, new 文本(key.getCounts (), +," ")); 前, } } System.out.println (“reduce 在…”); }
<强> 强>