Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hadoop >> mail # user >> map.input.file in Hadoop 0.20.0 map/reduce...

Copy link to this message
map.input.file in Hadoop 0.20.0 map/reduce...

   In migrating from the mapred.* classes to mapreduce.* classes I noticed I am not able to get "map.input.file" from the configuration returned from the Map.Context getConfiguration() method.  I didn't see an obvious answer but poking around I found I could get the file name as follows:

     public void setup(Context context) {
         FileSplit fileSplit = (FileSplit)context.getInputSplit();
         String input_fname = fileSplit.getPath().toString();

   Which is basically what is done in mapred.MapTask.

    That seems reasonable.  I guess my question is does that seem right?  Does it seem like an oversight to no longer set "map.input.file" or is it suggested to use context.getInputSplit() and get the filename from there.