hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Daniel Cryans <jdcry...@apache.org>
Subject Re: Pagination question
Date Tue, 16 Aug 2011 17:28:23 GMT
I guess the POSTFIX would be defined like this in your class:

private static final byte[] POSTFIX = new byte[] {0};

This is very different from something like:

new byte[0];

Which wouldn't add anything and lastRow would be returned.

Then you use the code you pasted.

J-D

On Tue, Aug 16, 2011 at 8:40 AM, Mark <static.void.dev@gmail.com> wrote:
> I'm reading the HBase book at
> http://ofps.oreilly.com/titles/9781449396107/clientapisadv.html and I have a
> question regarding pagination.
>
>  byte[] startRow = Bytes.add(lastRow, POSTFIX);
>
>
> "Since the lexicographical sorting of the row keys by HBase and the
> comparison taking care of finding the row keys in order, and the fact that
> the start key on a scan in always inclusive, you need to add an extra zero
> byte to the previous key. This will ensure that the last seen row key is
> skipped and the next, in sorting order, is found. The zero byte is the
> smallest increment and therefore safe to use when resetting the scan
> boundaries. Even if there were a row that would match the previous plus the
> extra zero byte the scan would be correctly doing the next iteration - this
> is because the start key is inclusive."
>
> What should be used as POSTFIX... ie how does one add a zero byte to an
> existing key?
>
> Thanks
>

Mime
View raw message