Hi,
There are many ways which you can pass objects using configuration.
Possibly the easiest way would be to use Stringifier interface.
you can for example :
DefaultStringifier.store(conf, variable ,"mykey");
variable = DefaultStringifier.load(conf, "mykey", variableClass );
you should take into account that the variable you pass to configuration
should be serializable by the framework. That means it must implement
Writable of Serializable interfaces. In your particular case, you might
want to look at ArrayWritable and MapWritable classes.
That said, you should however not pass large objects via configuration,
since it can seriously effect job overhead. If the data you want to pass
is large, then you should use other alternatives(such as
DistributedCache, HDFS, etc).
Tarandeep Singh wrote:
Hi,
How can I set a list or map to JobConf that I can access in
Mapper/Reducer class ?
The get/setObject method from Configuration has been deprecated and
the documentation says -
"A side map of Configuration to Object should be used instead."
I could not follow this :(
Can someone please explain to me how to do this ?
Thanks,
Taran