Mapreduce 映射器输出。collect()?

Mapreduce 映射器输出。collect()?,mapreduce,Mapreduce,映射程序会调用这两次 out.collect(new Text("Car"),new Text("Subaru"); out.collect(new Text("Cr-v"),new Text("Honda"); reduce()是否也会被调用两次?我假设你说的是OutputCollector.collect(K,V) reduce()。为了解释,假设您打电话: out.collect(new Text("Car"),new Text("Subaru"); out.collect(new Te

映射程序会调用这两次

out.collect(new Text("Car"),new Text("Subaru");
out.collect(new Text("Cr-v"),new Text("Honda");

reduce()
是否也会被调用两次?

我假设你说的是
OutputCollector.collect(K,V)

reduce()。为了解释,假设您打电话:

out.collect(new Text("Car"),new Text("Subaru");
out.collect(new Text("Car"),new Text("Honda");
out.collect(new Text("Car"),new Text("Ford");
out.collect(new Text("Truck"),new Text("Dodge");
out.collect(new Text("Truck"),new Text("Chevy");
然后将使用这些对调用两次
reduce()

reduce(Car, <Subaru, Honda, Ford>)
reduce(Truck, <Dodge, Chevy>)
reduce(汽车,)
减少(卡车)

因此,在您的示例中,是的,函数
reduce()
将被调用两次。我希望这能有所帮助。

你能提供更多的上下文吗?我想你说的是Hadoop的工作,但是没有细节,很难理解你在说什么。非常感谢。这对我帮助很大