You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@accumulo.apache.org by Mike Hugo <mi...@piragua.com> on 2013/01/23 19:50:52 UTC
Access to connector inside a Mapper class?
Is there a way to get access to the underlying connector being used by the
Accumulo Input Format inside the map method of a Mapper class? In certain
scenarios, I need to be able to look up a value from a different table
while iterating over a set of keys in the mapper class. Should I just
create a new connector instance?
Mike
Re: Access to connector inside a Mapper class?
Posted by Mike Hugo <mi...@piragua.com>.
Thanks Christopher and David, for the moment I am re-constructing a
Connector in the set up of the job based on the configuration parameters,
but I may also try out extending AccumuloInputFormat as it feels a little
cleaner.
Thanks!
Mike
On Sat, Jan 26, 2013 at 1:10 PM, Christopher <ct...@apache.org> wrote:
> If you extend AccumuloInputFormat to make the required protected methods
> public, you could do:
>
> MyAccumuloInputFormat.getInstance(context).getConnector(My
> AccumuloInputFormat.getUsername(context),MyAccumuloInputFormat.getPassword(context))
> with your TaskAttemptContext in the mapper/reducer.
>
> Or, you could store your own configuration options to re-construct a Connector
> when you set up your job (you could re-use those configuration variables we
> set, but that's... relying on implementation details that may change).
>
>
>
> --
> Christopher L Tubbs II
> http://gravatar.com/ctubbsii
>
>
> On Wed, Jan 23, 2013 at 1:50 PM, Mike Hugo <mi...@piragua.com> wrote:
>
>> Is there a way to get access to the underlying connector being used by
>> the Accumulo Input Format inside the map method of a Mapper class? In
>> certain scenarios, I need to be able to look up a value from a different
>> table while iterating over a set of keys in the mapper class. Should I
>> just create a new connector instance?
>>
>> Mike
>>
>
>
Re: Access to connector inside a Mapper class?
Posted by Christopher <ct...@apache.org>.
If you extend AccumuloInputFormat to make the required protected methods
public, you could do:
MyAccumuloInputFormat.getInstance(context).getConnector(My
AccumuloInputFormat.getUsername(context),MyAccumuloInputFormat.getPassword(context))
with your TaskAttemptContext in the mapper/reducer.
Or, you could store your own configuration options to re-construct a Connector
when you set up your job (you could re-use those configuration variables we
set, but that's... relying on implementation details that may change).
--
Christopher L Tubbs II
http://gravatar.com/ctubbsii
On Wed, Jan 23, 2013 at 1:50 PM, Mike Hugo <mi...@piragua.com> wrote:
> Is there a way to get access to the underlying connector being used by the
> Accumulo Input Format inside the map method of a Mapper class? In certain
> scenarios, I need to be able to look up a value from a different table
> while iterating over a set of keys in the mapper class. Should I just
> create a new connector instance?
>
> Mike
>
Re: Access to connector inside a Mapper class?
Posted by David Medinets <da...@gmail.com>.
>From http://accumulo.apache.org/1.4/apidocs/index.html?org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.html,
it looks like you can call getInstance().getConnector(...). Look at
http://accumulo.apache.org/1.4/apidocs/index.html?org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.html
to see the signatures of getConnector.
On Wed, Jan 23, 2013 at 1:50 PM, Mike Hugo <mi...@piragua.com> wrote:
> Is there a way to get access to the underlying connector being used by the
> Accumulo Input Format inside the map method of a Mapper class? In certain
> scenarios, I need to be able to look up a value from a different table while
> iterating over a set of keys in the mapper class. Should I just create a
> new connector instance?
>
> Mike