You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@accumulo.apache.org by "panqingcui@163.com" <pa...@163.com> on 2014/12/11 03:14:11 UTC

accumulo Scanner

HI 
Scanner full table, but need the data in each row, is the rowkey of the same
data, save data to JavaBean.
  
<http://apache-accumulo.1065345.n5.nabble.com/file/n12506/accumulo.png> 



--
View this message in context: http://apache-accumulo.1065345.n5.nabble.com/accumulo-Scanner-tp12506.html
Sent from the Developers mailing list archive at Nabble.com.

Re: accumulo Scanner

Posted by Ryan Leary <ry...@bbn.com>.
One option is to implement a class extending the RowEncodingIterator: 
http://accumulo.apache.org/1.6/apidocs/org/apache/accumulo/core/iterators/user/RowEncodingIterator.html <http://accumulo.apache.org/1.6/apidocs/org/apache/accumulo/core/iterators/user/RowEncodingIterator.html>

I personally have implementations that will automatically return a serialized protocol buffer or thrift object based on keys in the data. I think it should be possible to implement an iterator with rowEncoder and rowDecoder methods to convert to a JavaBean.


> On Dec 10, 2014, at 9:55 PM, Russ Weeks <rw...@newbrightidea.com> wrote:
> 
> You can use the WholeRowIterator to get a map of all key/value pairs for a
> single row. It works as long as your row is small enough to fit in memory.
> 
> I don't know of any libraries convert between a row and a JavaBean. Typo[2]
> is the closest project I know of.
> 
> -Russ
> 
> 1:
> http://accumulo.apache.org/1.6/apidocs/org/apache/accumulo/core/iterators/user/WholeRowIterator.html
> 2:https://github.com/keith-turner/typo
> 
> On Wed, Dec 10, 2014 at 6:14 PM, panqingcui@163.com <pa...@163.com>
> wrote:
> 
>> HI
>> Scanner full table, but need the data in each row, is the rowkey of the
>> same
>> data, save data to JavaBean.
>> 
>> <http://apache-accumulo.1065345.n5.nabble.com/file/n12506/accumulo.png>
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://apache-accumulo.1065345.n5.nabble.com/accumulo-Scanner-tp12506.html
>> Sent from the Developers mailing list archive at Nabble.com.
>> 


Re: accumulo Scanner

Posted by "panqingcui@163.com" <pa...@163.com>.
Thank you for your reply, have time to Chinese play.



--
View this message in context: http://apache-accumulo.1065345.n5.nabble.com/accumulo-Scanner-tp12506p12554.html
Sent from the Developers mailing list archive at Nabble.com.

Re: accumulo Scanner

Posted by Corey Nolet <cj...@gmail.com>.
You're going to want to use WholeRowIterator.decodeRow(entry.getKey(),
entry.getValue()) for that one. You can do:

for(Entry<Key,Value> entry : scanner) {
   for(Entry<Key,Value> actualEntry :
WholeRowIterator.decodeRow(entry.getKey(), entry.getValue()).entrySet()) {
        // do something with actualEntry
   }
}

On Thu, Dec 11, 2014 at 10:24 PM, panqingcui@163.com <pa...@163.com>
wrote:

> I try to use the WholeRowIterator, the same rowkey data into a line, Now,
> Value contains ColumnFamily, ColumnQualifier, value,but the value of Value
> should be how to analysis?
>
>  for (Entry<Key, Value> entry : scanner) {
>             log.info("" + entry.getKey() + "," + entry.getValue());
>         }
>
>
>
>
> --
> View this message in context:
> http://apache-accumulo.1065345.n5.nabble.com/accumulo-Scanner-tp12506p12552.html
> Sent from the Developers mailing list archive at Nabble.com.
>

Re: accumulo Scanner

Posted by "panqingcui@163.com" <pa...@163.com>.
I try to use the WholeRowIterator, the same rowkey data into a line, Now,
Value contains ColumnFamily, ColumnQualifier, value,but the value of Value
should be how to analysis? 

 for (Entry<Key, Value> entry : scanner) {
            log.info("" + entry.getKey() + "," + entry.getValue());
        }




--
View this message in context: http://apache-accumulo.1065345.n5.nabble.com/accumulo-Scanner-tp12506p12552.html
Sent from the Developers mailing list archive at Nabble.com.

Re: accumulo Scanner

Posted by Russ Weeks <rw...@newbrightidea.com>.
You can use the WholeRowIterator to get a map of all key/value pairs for a
single row. It works as long as your row is small enough to fit in memory.

I don't know of any libraries convert between a row and a JavaBean. Typo[2]
is the closest project I know of.

-Russ

1:
http://accumulo.apache.org/1.6/apidocs/org/apache/accumulo/core/iterators/user/WholeRowIterator.html
2:https://github.com/keith-turner/typo

On Wed, Dec 10, 2014 at 6:14 PM, panqingcui@163.com <pa...@163.com>
wrote:

> HI
> Scanner full table, but need the data in each row, is the rowkey of the
> same
> data, save data to JavaBean.
>
> <http://apache-accumulo.1065345.n5.nabble.com/file/n12506/accumulo.png>
>
>
>
> --
> View this message in context:
> http://apache-accumulo.1065345.n5.nabble.com/accumulo-Scanner-tp12506.html
> Sent from the Developers mailing list archive at Nabble.com.
>