0
我有兩個名爲A.txt和B.txt的不同文件。如何使用從兩個映射器到一個reducer的鍵和值?
A.txt: B.txt
id name des id name
1 one 0 1 apple
2 two 1 2 pine
3 three 0 3 orange
在這裏,我在這兩個文件中都有相同的字段「id」。 我使用了兩個mapper類。一個用於A.txt,另一個用於B.txt。有一個減速器類。
In MapperA.class "des" is checked and if "0" then its id is sent as key and value as name.
In MapperB.class id and name is sent as key and value.
Now, in reducer I need to determine the "id" from MapperA and check with "id" from MapperB and if present, then send key as "id" and value as "name".
How can we compare the key and value from two mapper in a reducer to get desired result?
從減速機所需的輸出是:
id name
1 apple
3 orange
我需要通過比較「des」值並將該ID傳遞給reducer來確定「id」。 – bthapa