srikanth
srikanth

Reputation: 978

Can Reducer read the same order af mapper output instead of group unique keys with values?

I have a basic understanding of how Hadoop order the data from Mapper to Reducer. I have the following data written to context Mapper. The below data is a key, value pair

abc 1234
cde 2394
dec 8273
abc 2348
cde 8780
dec 6590

Key's abc, cde, dec continuous for n-times with same or different values. Reducer reads in key with group of values. I.e

abc {1234, 2348, ...} and so on with other keys.

Question: Is there a possibility of reading data into reducer in a same order of Mapper output, instead of unique keys group with values ?

Upvotes: 0

Views: 74

Answers (1)

madhu
madhu

Reputation: 1170

If you are required to process the data based on header then i think you can use the below approach:-

Mapper :-

Cut the header and make that as your key and the remaining data as your value. Now all of the data for that particular header will move to the reducer.

Reducer :-

We will be having these values in reducer without grouping.

abc 1234
cde 2394
dec 8273
abc 2348
cde 8780
dec 6590

Then we will be able to process the data individually.

Upvotes: 0

Related Questions