Map Reduce Programs

wordcount:

A map/reduce program that counts the words in the input files.

Usage:bin/hadoop jar <path to jar file> wordcount <path of input file> <path of output directory>

Let us take the movies.txt file as input,which contains the following text data,

1,The Nightmare Before Christmas,1993,3.9,4568
2,The Mummy,1932,3.5,4388
3,Orphans of the Storm,1921,3.2,9062
4,The Object of Beauty,1991,2.8,6150
5,Night Tide,1963,2.8,5126
6,One Magic Christmas,1985,3.8,5333
7,Muriel’s Wedding,1994,3.5,6323
8,Mother’s Boys,1994,3.4,5733
9,Nosferatu: Original Version,1929,3.5,5651
10,Nick of Time,1995,3.4,5333

Then on executing the wordcount program we get the following output:

1,The 1
10,Nick 1
2,The 1
3,Orphans 1
4,The 1
5,Night 1
6,One 1
7,Muriel’s 1
8,Mother’s 1
9,Nosferatu: 1
Beauty,1991,2.8,6150 1
Before 1
Boys,1994,3.4,5733 1
Christmas,1985,3.8,5333 1
Christmas,1993,3.9,4568 1
Magic 1
Mummy,1932,3.5,4388 1
Nightmare 1
Object 1
Original 1
Storm,1921,3.2,9062 1
Tide,1963,2.8,5126 1
Time,1995,3.4,5333 1
Version,1929,3.5,5651 1
Wedding,1994,3.5,6323 1
of 3
the 1

Thus we can conclude that on executing the wordcount program we get the number of occurrence of a given word in a file.

<word> <no. of times it has occurred>

Screeshots:

wc wcR

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s