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 Jeremy Chow <co...@gmail.com> on 2008/04/03 10:22:24 UTC

If I wanna read a config file before map task, which class I should choose?

Hi list,

If I define a method named configure in a mapper class which try to read a
config file before all map tasks start, which class I should choose?
A normal FileReader from jdk or another Reader provided by hadoop ?  Can
anyone give me an example?

Thx,
Jeremy
-- 
My research interests are distributed systems, parallel computing and
bytecode based virtual machine.

http://coderplay.javaeye.com

Re: If I wanna read a config file before map task, which class I should choose?

Posted by Jeremy Chow <co...@gmail.com>.
the config file is a normal text file.
-- 
My research interests are distributed systems, parallel computing and
bytecode based virtual machine.

http://coderplay.javaeye.com

Re: If I wanna read a config file before map task, which class I should choose?

Posted by Ted Dunning <td...@veoh.com>.
Just write a parser and put it into the configure method.


On 4/3/08 8:31 PM, "Jeremy Chow" <co...@gmail.com> wrote:

> thanks, the configure file format looks like below,
> 
> @tag_name0 name0 {value00, value01, value02}
> @tag_name1 name1 {value10, value11, value12}
> 
> and reading it from HDFS. Then how can I parse them ?


Re: If I wanna read a config file before map task, which class I should choose?

Posted by Jeremy Chow <co...@gmail.com>.
thanks, the configure file format looks like below,

@tag_name0 name0 {value00, value01, value02}
@tag_name1 name1 {value10, value11, value12}

and reading it from HDFS. Then how can I parse them ?

Re: If I wanna read a config file before map task, which class I should choose?

Posted by Ted Dunning <td...@veoh.com>.
That depends on where the file is.  If you are reading a file on a normal
file system, you use normal Java functions.  If you are reading a file from
HDFS, you use hadoop functions.


On 4/3/08 1:22 AM, "Jeremy Chow" <co...@gmail.com> wrote:

> Hi list,
> 
> If I define a method named configure in a mapper class which try to read a
> config file before all map tasks start, which class I should choose?
> A normal FileReader from jdk or another Reader provided by hadoop ?  Can
> anyone give me an example?
> 
> Thx,
> Jeremy