I am writing a map reduce program to find the file that contains the most words.
Now, I am able to use map reduce to find the number of words contained in each file. However, I am unsure how I can store the number of words in each file and then compare it and find the file that contains the most words using map reduce.
My idea so far:
Having several jobs to find the number of words in each file, like this
file_name | number of words
file_1 5
file_2 10
file_3 15
then start another job, in the reducer find the maximum number of words and finally get the following result
file_3
I wonder: does the approach make sense? Is there any other way to find the file that contains the most words via map reduce?