You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@accumulo.apache.org by "Colclough, Christopher M." <Ch...@jhuapl.edu> on 2012/05/24 15:42:01 UTC

Scan and display entire row

New to Accumulo and very much in the process of learning the API.

I've written a scanner to return the map of <Key,Value> pairs, but it returns only the table key:table value.  I'd like to have it return the entire row from the table, just like the scan operator does when using the Accumulo shell.  What class/method should I use to do this?

Current environment is Accumulo 1.3.5

RE: Scan and display entire row

Posted by "Colclough, Christopher M." <Ch...@jhuapl.edu>.
That's it!  I failed to look at all the method supplied by the Key object.
Thanks to all...

From: Jared winick [mailto:jaredwinick@gmail.com]
Sent: Thursday, May 24, 2012 10:02 AM
To: user@accumulo.apache.org
Subject: Re: Scan and display entire row

The Key (http://accumulo.apache.org/1.4/apidocs/org/apache/accumulo/core/data/Key.html) has methods to get the row, column family, and column qualifier, so that would give you all the information you see printed in the Accumulo shell.  Like John says, the Key is not just a row ID. See the "Data Model" section at  http://accumulo.apache.org/1.4/user_manual/Accumulo_Design.html  for a visual representation of a Key in Accumulo.
On Thu, May 24, 2012 at 7:49 AM, John Armstrong <jr...@ccri.com>> wrote:
On 05/24/2012 09:42 AM, Colclough, Christopher M. wrote:
I've written a scanner to return the map of <Key,Value> pairs, but it
returns only the table key:table value. I'd like to have it return the
entire row from the table, just like the scan operator does when using
the Accumulo shell. What class/method should I use to do this?

I'm not sure what you mean.  Can you give an example of the behavior you're seeing and the behavior you want?

Accumulo tables are (basically) big sorted maps of (Key, Value) pairs, where the Keys have a certain structure and native sort order.  Scanners return some collection of such pairs.


Re: Scan and display entire row

Posted by Jared winick <ja...@gmail.com>.
The Key (
http://accumulo.apache.org/1.4/apidocs/org/apache/accumulo/core/data/Key.html)
has methods to get the row, column family, and column qualifier, so that
would give you all the information you see printed in the Accumulo shell.
 Like John says, the Key is not just a row ID. See the "Data Model" section
at  http://accumulo.apache.org/1.4/user_manual/Accumulo_Design.html  for a
visual representation of a Key in Accumulo.

On Thu, May 24, 2012 at 7:49 AM, John Armstrong <jr...@ccri.com> wrote:

> On 05/24/2012 09:42 AM, Colclough, Christopher M. wrote:
>
>> I’ve written a scanner to return the map of <Key,Value> pairs, but it
>> returns only the table key:table value. I’d like to have it return the
>> entire row from the table, just like the scan operator does when using
>> the Accumulo shell. What class/method should I use to do this?
>>
>
> I'm not sure what you mean.  Can you give an example of the behavior
> you're seeing and the behavior you want?
>
> Accumulo tables are (basically) big sorted maps of (Key, Value) pairs,
> where the Keys have a certain structure and native sort order.  Scanners
> return some collection of such pairs.
>

Re: Scan and display entire row

Posted by John Armstrong <jr...@ccri.com>.
On 05/24/2012 09:42 AM, Colclough, Christopher M. wrote:
> I’ve written a scanner to return the map of <Key,Value> pairs, but it
> returns only the table key:table value. I’d like to have it return the
> entire row from the table, just like the scan operator does when using
> the Accumulo shell. What class/method should I use to do this?

I'm not sure what you mean.  Can you give an example of the behavior 
you're seeing and the behavior you want?

Accumulo tables are (basically) big sorted maps of (Key, Value) pairs, 
where the Keys have a certain structure and native sort order.  Scanners 
return some collection of such pairs.

Re: Scan and display entire row

Posted by Billie J Rinaldi <bi...@ugov.gov>.
On Thursday, May 24, 2012 9:42:01 AM, "Christopher M. Colclough" <Ch...@jhuapl.edu> wrote:
> New to Accumulo and very much in the process of learning the API.
> 
> 
> 
> I’ve written a scanner to return the map of <Key,Value> pairs, but it
> returns only the table key:table value. I’d like to have it return the
> entire row from the table, just like the scan operator does when using
> the Accumulo shell. What class/method should I use to do this?
> 
> 
> 
> Current environment is Accumulo 1.3.5

I need more information about what you're trying to do.  The "scan" command in the shell just uses a Scanner, so the same things will be returned in both.  Are you trying to get a single row back from the Scanner?  If so, you can say scanner.setRange(new Range(row)).  If you are trying to iterate over rows, in Accumulo 1.4 you will be able to wrap the scanner in a RowIterator, which implements Iterator<Iterator<Entry<Key,Value>>>.

Billie