0
我正在与hadoop一起编写一个非常初始的编程任务,并且还会使用经典的wordcount问题。减速器停留在70%
已经在hdfs上放了一个示例文件,并试图在其上运行wordcount。映射器经过得很好,但是,减速器停留在70%,永远不会前进。
我也尝试过使用本地文件系统上的文件,并获得相同的行为。
我能做什么错? 这里有地图和减少功能 -
public void map(LongWritable key, Text value,
OutputCollector<Text, IntWritable> output, Reporter reporter)
throws IOException {
// TODO Auto-generated method stub
String line = value.toString();
String[] lineparts = line.split(",");
for(int i=0; i<lineparts.length; ++i)
{
output.collect(new Text(lineparts[i]), new IntWritable(1));
}
public void reduce(Text key, Iterator<IntWritable> values,
OutputCollector<Text, IntWritable> output, Reporter reporter)
throws IOException {
// TODO Auto-generated method stub
int count = 0;
while(values.hasNext())
{
count=count+1;
}
output.collect(key , new IntWritable(count));
}
完美,感谢您快速查找错误。 – Gyan