倒排索引 mr实现

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/huuuuuuuu/article/details/58587433
Map阶段
<0,"this is google">
....


context.write("google ->a.txt",1);
context.write("google ->a.txt",1);
context.write("google ->a.txt",1);
context.write("google ->a.txt",1);
context.write("google ->a.txt",1);

context.write("google ->b.txt",1);
context.write("google ->b.txt",1);
context.write("google ->b.txt",1);
--------------------------------------------------------
combiner阶段
<"google ->a.txt",1>
<"google ->a.txt",1>
<"google ->a.txt",1>
<"google ->a.txt",1>
<"google ->a.txt",1>

<"google ->b.txt",1>
<"google ->b.txt",1>
<"google ->b.txt",1>

context.write("google ","a.txt->5");
context.write("google ","b.txt->3");
--------------------------------------------------------
Reducer阶段
<"hello",{"a.txt->5","b.txt->3"}>


context.write("hello","a.txt->5 b.txt->3");
-------------------------------------------------------
hello    "a.txt->5 b.txt->3"
tom        "a.txt->2 b.txt->1"
kitty    "a.txt->1"
.......

猜你喜欢

转载自blog.csdn.net/huuuuuuuu/article/details/58587433
今日推荐