Reputation: 141
I am new to hadoop2.60. I have written a MapReduce algorithm. Data set is like below 1 loan 1234
2 loan 234
1 asd 1234
1 aqw 1234
1 asde 1267
2 qwer 1246
I want that if firstColumn is 1, then all the data of that line should go to file1-output else all the data shuld go to file2-output.
How to achieve this in map-reduce.
Upvotes: 0
Views: 139
Reputation: 369
Yes you can do that. This can be achieved by MultipleOutputFormat and using its generateFileNameForKeyValue.
Using the if conditions and MultipleOutputFormat this can be achieved easily.
You can see this for more examples. Is it possible to have multiple output files for a map-reduce?
I hope I could answer your questions.
Upvotes: 1