You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Richa Khandelwal <ri...@gmail.com> on 2009/03/07 08:18:30 UTC
mapred.input.file returns null
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
Re: mapred.input.file returns null
Posted by Amandeep Khurana <am...@gmail.com>.
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 <ri...@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
>
Re: mapred.input.file returns null
Posted by Richa Khandelwal <ri...@gmail.com>.
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 <ri...@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 <am...@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
Re: mapred.input.file returns null
Posted by Richa Khandelwal <ri...@gmail.com>.
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 <am...@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
Re: mapred.input.file returns null
Posted by Amandeep Khurana <am...@gmail.com>.
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 <ri...@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
>