倒排索引 mr实现

来源:互联网 发布:江苏省软件测试中心 编辑:程序博客网 时间:2024/04/29 18:58
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"
.......
0 0
原创粉丝点击