2013-01-14 38 views
0

可能是一个非常蹩脚的问题。 我有两个文件,我想找到这两个文件在地图中减少的方式,然后比较重叠的重叠(可以说我有一些措施来做到这一点)还原剂后进一步处理

所以这是我的想法:

1) Run the normal wordcount job on one document (https://sites.google.com/site/hadoopandhive/home/hadoop-how-to-count-number-of-times-a-word-appeared-in-a-file-using-map-reduce-framework) 
2) But rather than saving a file, save everything in a HashMap(word,true) 
3) Pass that HashMap along the second wordcount mapreduce program and then as I am processing the second document, check the words against the HashMap to find whether the word is present or not. 

所以,像这样

1) HashMap<String, boolean> hm = runStepOne(); <-- map reduce job 
2) runSteptwo(HashMap<String, boolean>) 

如何在Hadoop中做到这一点

回答

3

听起来像是你可以使用某种形式的DistributeCache在初始wordcount作业之后存储您的中间结果,然后运行利用这些中间结果的另一个作业以测试它们是否出现在第二个文档中。您可能能够将这两个步骤封装到一个MR作业中,但是我不知道该如何。