hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From harry lippy <harryli...@gmail.com>
Subject Question about how input data is presented to the map function
Date Fri, 16 Sep 2011 13:26:35 GMT
Hi from a total noob:

I'm working my way through 'Hadoop:  The Definitive Guide', by Tom White.
 In chapter 2, he works through an example of taking weather data from the
NCDC and computing the maximum temperature for the given years.  There is a
small sample test file to try out the code, and it looks like:


In the middle of page 19, he says

"These lines are presented to the map function as the key-value pairs:


The keys are file offsets into the input file.  My question:  how did the
'are presented to the map function as key-value pairs' happen?  I've run the
example on the input file using the java Mapper, Reducer, and the code that
runs the job - none of which seems, to my novice eye, to massage the input
from the file to the map function in the (file offset, line of data from
file) key-value format - and the results are correct.

Does hadoop automagically create key-value pairs of this format (file
offset, line of data from file)?  If so, is there a way to get hadoop to
present the data to the map function in a different format?

I should probably finish reading the book, as my question will probably be
answered there, but I hate moving forward with the feeling that I am missing

Thanks, everybody!


View raw message