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 <[email protected]>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 <[email protected]
> >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 <[email protected]
> >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 <[email protected]
> >> >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
>