hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Rawson <ryano...@gmail.com>
Subject Re: Scanning half a key or value in HBase
Date Tue, 17 Aug 2010 19:01:10 GMT

One thing to watch out for is ascii with separator variable length
keys, you would think if your key structure was:


starting at 'foo' and ending at 'foo:' might give you only keys which
start with 'foo:' but this doesn't work like that.  You also get keys

you must start the scan at 'foo:' but you can't just end it at 'foo;'
(since next(:) == ';' in ascii), this has to do with the ordering of
ASCII, for a reference look at http://www.asciitable.com/

The bug-free solution is to start your scan at 'foo:' and use a prefix
filter set to 'foo:'.

If you are scanning fixed-width keys, eg: binary conversions of longs,
then the [start,start+1) solution works.

On Tue, Aug 17, 2010 at 5:59 AM, Andrey Stepachev <octo47@gmail.com> wrote:
> Use scan where start key is <first_half_of_key> itself as bytearray, and
> stop key is <first_half_of_key> with last byte in bytearray + 1.
> example
> abc% should be scan(abc, abd)
> 2010/8/17 Michelan Arendse <michelan@addynamo.com>:
>> Hi
>> I am not sure if this is possible in HBase. What I am trying to do is scan on a HBase
table with something similar to how SQL would do it.
>> e.g. SELECT *
>>         FROM <table>
>>         WHERE <primary key> LIKE '<first_half_of_key>%' ;
>> So as you can see from above I want to scan the table with only part of the row key,
since the key is a combination of 2 fields in the table.
>> Regards,
>> Michelan Arendse

View raw message