0
我使用Hadoop 0.21.0。我想輸出到兩個不同的文件,所以我試圖讓MultipleOutputs工作。這裏是我的降低:Hadoop的MultipleOutputs拋出「找不到符號」
public static class Reduce extends MapReduceBase implements Reducer < Text, Text > {
private MultipleOutputs mos;
public void configure(JobConf conf) {
mos = new MultipleOutputs(conf);
}
public void reduce(Text key, Iterator <Text> values, OutputCollector < Text, Text > output, Reporter reporter) throws IOException {
mos.getCollector("A", reporter).collect(key, new Text("Hello"));
mos.getCollector("B", reporter).collect(key, new Text("Bye"));
mos.getCollector("C", reporter).collect(key, new Text("Chau"));
}
public void close() throws IOException {
mos.close();
}
}
但是當我嘗試編譯此我得到這些錯誤:
Main.java:41: error: cannot find symbol
private MultipleOutputs mos;
^
symbol: class MultipleOutputs
location: class Reduce
Main.java:45: error: cannot find symbol
mos = new MultipleOutputs(conf);
^
symbol: class MultipleOutputs
location: class Reduce
雖然我加入了這一點:import org.apache.hadoop.mapred.*
; 在代碼的開頭。
誰能告訴我爲什麼我得到這些錯誤? 我該如何解決這個問題?
謝謝您的回答。我添加了import org.apache.hadoop.mapred.lib。*;和它一起工作警告!很奇怪,因爲我已經加入進口org.apache.hadoop.mapred *。 – 2013-05-12 18:14:11