Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - Fastest way to read only the keys of a HTable?


Copy link to this message
-
Re: Fastest way to read only the keys of a HTable?
Something Something 2011-02-03, 06:47
Thanks.  So I will add this...

   scan.setFilter(new FirstKeyOnlyFilter());

But after I do this...

   Result result = scanner.next();

There's no...  result.getKey() - so what method would give me the Key value?

On Wed, Feb 2, 2011 at 10:20 PM, Stack <[EMAIL PROTECTED]> wrote:

> See
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.html
> St.Ack
>
> On Thu, Feb 3, 2011 at 6:01 AM, Something Something
> <[EMAIL PROTECTED]> wrote:
> > I want to read only the keys in a table. I tried this...
> >
> >    try {
> >
> >  HTable table = new HTable("myTable");
> >
> >  Scan scan = new Scan();
> >
> >  scan.addFamily(Bytes.toBytes("Info"));
> >
> >  ResultScanner scanner = table.getScanner(scan);
> >
> >   Result result = scanner.next();
> >
> >  while (result != null) {
> >
> > & so on...
> >
> > This was performing fairly well until I added another Family that
> contains
> > lots of key/value pairs.  My understanding was that adding another family
> > wouldn't affect performance of this code because I am explicitly using
> > "Info", but it is.
> >
> > Anyway, in this particular use case, I only care about the "Key" of the
> row.
> >  I don't need any values from any of the families.  What's the best way
> to
> > do this?
> >
> > Please let me know.  Thanks.
> >
>