hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Stepachev <oct...@gmail.com>
Subject Re: Scanning half a key or value in HBase
Date Wed, 18 Aug 2010 05:31:50 GMT
2010/8/17 Ryan Rawson <ryanobjc@gmail.com>:
> Hey,
>
>
> If you are scanning fixed-width keys, eg: binary conversions of longs,
> then the [start,start+1) solution works.
>

Why? It will work for any byte array, if we want to prefix scan. And no matter,
what key encoding we use.

If we look at first email question, we see '<first_half_of_key>%', so
if first_half_of_key = 'foo'
we _should_ get all keys foo, foo:, foo1234, because we want this.

My solution was to convert requested first_half_of_key to byte[] arr = ...
Then do  (pseudocode)
arr = toBytes(first_half_of_key)
arr2 = arr.clone(),
arr2[arr2.length-1]++,
STARTROW = arr,
STOPROW = arr2;

This gives us real stop key, which will be greater, then any key,
prefixed with given prefix
(due of nature of binary comparators, used by hbase).

Or I missed something ?

Mime
View raw message