Initializing Mapper classes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Initializing Mapper classes

alakshman
Is there a way to initialize Mapper classes based on some args passed
through the command line ? Ideally I would like to do conf.setMapperClass(
Mapper.class ) which I am assuming ultimately creates an instance of this
class by invoking the default ctor ? But is it possible to initialize some
member variables in the Mapper class ?

Thanks
A
Reply | Threaded
Open this post in threaded view
|

RE: Initializing Mapper classes

Mahajan, Neeraj
You can do conf.set(<param>, <value>) when you create the conf before
submitting the job. In the mapper class' configure() method you can
fetch the params by job.get(<param>). The configure method is called to
initialize a new instance of the mapper/reducer.

~ Neeraj

-----Original Message-----
From: Phantom [mailto:[hidden email]]
Sent: Friday, July 13, 2007 10:50 AM
To: [hidden email]
Subject: Initializing Mapper classes

Is there a way to initialize Mapper classes based on some args passed
through the command line ? Ideally I would like to do
conf.setMapperClass( Mapper.class ) which I am assuming ultimately
creates an instance of this class by invoking the default ctor ? But is
it possible to initialize some member variables in the Mapper class ?

Thanks
A