請問setOutputKeyClass與setOutputValueClass
是取決於Map與Reduce的輸出型別是什麼
今天我的問題是當我Map與Reduce型別不同時,我的setOutputKeyClass改寫為
public static class MSTMapper extends
Mapper<Object, Text, IntWritable, Text> {}
static class MSTReducer extends Reducer<IntWritable, Text, Text, Text> {}
Map輸出為(intWritable, Text) Reduce為(Text, Text>)
我寫為:
job.setMapOutputKeyClass(IntWritable.class);
job.setMapOutputValueClass(Text.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
請問這個寫法有錯誤嗎 我是上網找的
在Reduce輸出型別都顯示錯誤
所以想問大大門因該要怎麼寫才對
雖然我後來有把程式都改成統一Text型別,但還是想知道這個問題該怎麼解決!?
再請問我看得一個程式,不管setNumReduceTasks設定為多少
Reduce執行的動作永遠是key1 -> key2 -> key3 -> key4 -> key5
並不會出現若 reducer 個數是 3
reducer #1 : key1 -> key4
reducer #2 : key2 -> key5
reducer #3 : key3
這樣...請問是否程式哪個地方還可以設定成只以一個Redcue來跑呢??(永遠都是全域排序!?)
原始碼連結:
http://hadooptutorial.wikispaces.com/file/view/MST.javahttp://hadooptutorial.wikispaces.com/file/view/ExampleBaseJob.java/239931339/ExampleBaseJob.java