做MapReduce時結果不一致問題

59 views
Skip to first unread message

Yafang

unread,
Dec 8, 2011, 1:52:34 AM12/8/11
to nthu-201...@googlegroups.com
有同學提到 在做 Lab2 Part I,和 Lab3 Part I時
用sample input做MapReduce
結果可能會出現30多項 或是 70多項
這個地方是因為main function combiner
設定不同所造成的

若是直接assign myreducer.class到combiner的部分
 job.setCombinerClass(myreducer.class);
則執行出來的結果就只會有30多項


但若你另外做一個mycombiner.java
 job.setCombinerClass(mycombiner.class);
則執行出來的結果會有70多項


這是因為combiner的工作是做
local aggregation of the intermediate outputs
官方網站上的定義是
Users can optionally specify a combiner, via JobConf.setCombinerClass(Class), to perform local aggregation of the intermediate outputs, which helps to cut down the amount of data transferred from the Mapper to the Reducer.
沒設計好的話會有些資料被事先過濾掉導致結果錯誤
設計良好則可以加快整體執行的速度

所以請同學在這個部分稍微注意
因為已經有給提示
在評分時會根據答案的完整性來給分

另外reducer的個數只會影響輸出的先後順序 並不會讓內容有所改變

有問題的話歡迎提出
謝謝
Reply all
Reply to author
Forward
0 new messages