映射方法:接收为输入(K1,V1)并返回(K2,V2)。也就是说,输出键和值可以与输入键和值不同。减速器方法:在映射器的输出已正确洗牌(同一个键到同一个减速器)后,减速器输入为(K2,LIST(V2)),其输出为(K3,V3)。 作为洗牌过程的结果,密钥到达按键K2排序的减速器。
如果您想以特定方式订购密钥,则可以实现密钥K3的compareTo方法。
Referring your questions:
1. Answered above.
2. You can emit whatever you want as long it consists of a key and a value.
For example, in the WordCount you send as key the word and as value 1.
3. In the WordCount example, the reducer will receive a word and list of number.
Then, it will sum up the numbers and emit the word and its sum.
4. Answered above.
5. Answered above.
我的理解是 1.它接受一个键值对作为输入,并可以输出任意数量的键值对作为输出,包括零。 2.对于每个键/值pari,它们根据需要发出与中间键/值对一样多的键,并且不能是相同类型。 3.缩减器根据需要发出尽可能多的最终键值对。 4.价值是有序排列的,而且从运行到运行都是非常有序的。 这是正确的吗?如果我错了,让我知道。 – user1647267
在洗牌阶段,数值不是排序还是上升或下降? – user1647267
这些值没有排序。只有钥匙。 – barak1412