hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amandeep Khurana <ama...@gmail.com>
Subject Re: mapred.input.file returns null
Date Sat, 07 Mar 2009 07:27:31 GMT
You have to use the configure function inside your mapper (just in case you
arent). The files are read in the map phase. Here's how you do it:

    public static class Map extends MapReduceBase
            implements Mapper<LongWritable,Text,Text,Text>
    {
        String inputfile;

        public void map(LongWritable key, Text value,
                OutputCollector<Text, Text> output, Reporter reporter)
                throws IOException
        {

        }

        public void configure(JobConf job) {
            inputfile = job.get("map.input.file");
        }

        }

}


Amandeep Khurana
Computer Science Graduate Student
University of California, Santa Cruz


On Fri, Mar 6, 2009 at 11:22 PM, Richa Khandelwal <richak29@gmail.com>wrote:

> I changed "mapred.input.file" to "map.input.file" based on a post by JIRA
> which claimed that its a typo
>
> On Fri, Mar 6, 2009 at 11:21 PM, Richa Khandelwal <richak29@gmail.com
> >wrote:
>
> > Here's a snippet of my code:
> >  private static String inputFile;
> >
> >   public void configure(JobConf job)
> >   {
> >     inputFile=job.get("map.input.file");
> >     System.out.println("File "+inputFile);
> >   }
> >
> >
> >
> > On Fri, Mar 6, 2009 at 11:19 PM, Amandeep Khurana <amansk@gmail.com
> >wrote:
> >
> >> How are you using it?
> >>
> >>
> >> Amandeep Khurana
> >> Computer Science Graduate Student
> >> University of California, Santa Cruz
> >>
> >>
> >> On Fri, Mar 6, 2009 at 11:18 PM, Richa Khandelwal <richak29@gmail.com
> >> >wrote:
> >>
> >> > Hi All,
> >> > I am trying to retrieve the names of files for each record that I am
> >> > processing. Using "mapred.input.file" returns null. Does anyone know
> the
> >> > workaround or the fix to this?
> >> >
> >> > Thanks,
> >> > Richa Khandelwal
> >> >
> >> >
> >> > University Of California,
> >> > Santa Cruz.
> >> > Ph:425-241-7763
> >> >
> >>
> >
> >
> >
> > --
> > Richa Khandelwal
> >
> >
> > University Of California,
> > Santa Cruz.
> > Ph:425-241-7763
> >
>
>
>
> --
> Richa Khandelwal
>
>
> University Of California,
> Santa Cruz.
> Ph:425-241-7763
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message