hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harsh J <ha...@cloudera.com>
Subject Re: How do I configure a Partitioner in the new API?
Date Wed, 04 May 2011 06:35:02 GMT

On Wed, May 4, 2011 at 5:13 AM, W.P. McNeill <billmcn@gmail.com> wrote:
> I have a new-API
> Partitioner<http://hadoop.apache.org/common/docs/r0.20.0/api/org/apache/hadoop/mapreduce/Partitioner.html>object
> whose behavior needs to change based on values passed in from the job
> configuration. It looks like there's no way to do this because the
> Partitioner never gets passed a context, and the Hadoop framework creates
> the actual Partitioner instance so I can't write a constructor. How do I
> parameterize my Partitioner?

You can make your class implement Configurable, and then use the
Configuration object passed to its methods automatically upon its
instantiation. This way you can use parameters available in the
Configuration (of the submitted Job) at least.

I'm not sure how you could pass a complete 'context' object to it.

Harsh J

View raw message