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 Deyaa Adranale <de...@iais.fraunhofer.de> on 2008/07/31 11:48:41 UTC

mapper input file name

Hi,

I need to know inside my mapper, the name of the file that contains the 
current record.
I saw that I can access the name of the input directories inside 
mapper.config(), but my input contains different files and I need to 
know the name of the current one.

any hints?

thanks in advance,

Deyaa

Re: mapper input file name

Posted by Kevin <kl...@gmail.com>.
OK. I guess I find out how. Override the "configure" method of user
defined Map class so that you can take note of the filename.

-Kevin



On Mon, Aug 4, 2008 at 3:53 PM, Kevin <kl...@gmail.com> wrote:
> Is it possible to get this information in user defined map function?
> i.e., how do we get the JobConf object in map() function?
>
> Another way is to subclass RecordReader to embed file-name in the
> data, which does not look simple.
>
> -Kevin
>
>
>
> On Sun, Aug 3, 2008 at 10:17 PM, Amareshwari Sriramadasu
> <am...@yahoo-inc.com> wrote:
>> You can get the file name accessed by the mapper using the config property
>> "map.input.file"
>>
>> Thanks
>> Amareshwari
>> Deyaa Adranale wrote:
>>>
>>> Hi,
>>>
>>> I need to know inside my mapper, the name of the file that contains the
>>> current record.
>>> I saw that I can access the name of the input directories inside
>>> mapper.config(), but my input contains different files and I need to know
>>> the name of the current one.
>>>
>>> any hints?
>>>
>>> thanks in advance,
>>>
>>> Deyaa
>>
>>
>

Re: mapper input file name

Posted by Kevin <kl...@gmail.com>.
Is it possible to get this information in user defined map function?
i.e., how do we get the JobConf object in map() function?

Another way is to subclass RecordReader to embed file-name in the
data, which does not look simple.

-Kevin



On Sun, Aug 3, 2008 at 10:17 PM, Amareshwari Sriramadasu
<am...@yahoo-inc.com> wrote:
> You can get the file name accessed by the mapper using the config property
> "map.input.file"
>
> Thanks
> Amareshwari
> Deyaa Adranale wrote:
>>
>> Hi,
>>
>> I need to know inside my mapper, the name of the file that contains the
>> current record.
>> I saw that I can access the name of the input directories inside
>> mapper.config(), but my input contains different files and I need to know
>> the name of the current one.
>>
>> any hints?
>>
>> thanks in advance,
>>
>> Deyaa
>
>

Re: mapper input file name

Posted by Amareshwari Sriramadasu <am...@yahoo-inc.com>.
You can get the file name accessed by the mapper using the config 
property "map.input.file"

Thanks
Amareshwari
Deyaa Adranale wrote:
> Hi,
>
> I need to know inside my mapper, the name of the file that contains 
> the current record.
> I saw that I can access the name of the input directories inside 
> mapper.config(), but my input contains different files and I need to 
> know the name of the current one.
>
> any hints?
>
> thanks in advance,
>
> Deyaa