hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lars hofhansl <lhofha...@yahoo.com>
Subject Re: Scans and lexical sorting
Date Thu, 17 Nov 2011 18:49:28 GMT
That's better I agree. stop key = start key is valid, though (it becomes a get then).

Should definitely mention that startKey is inclusive and stopKey is exclusive and start <=
match < stop.


----- Original Message -----
From: Joe Pallas <pallas@cs.stanford.edu>
To: user@hbase.apache.org
Cc: 
Sent: Thursday, November 17, 2011 9:58 AM
Subject: Re: Scans and lexical sorting


On Nov 16, 2011, at 9:17 AM, lars hofhansl wrote:

> Hi Mark,
> good find. I think that works by accident and the book is wrong.
> "row" +  new byte[] {0} will use byte[].toString() and actually result in something
like: "row[B@152b6651", which (again accidentally) sorts past rowN.
> "row" + new byte[] {255} is not better, though.
> 
> You'd have to construct a byte array that is terminated by 255.
> An easy way to do that is: byte[] row = new byte[] {'r','o','w',-1}
> 
> We need to fix the book.

Wouldn’t the truly correct stopRow be "rox" (since 'w' + 1 == 'x' in Unicode)?

The comment in the example (“note: stop key != start key”) is confusing, too.  It would
be better to say explicitly that the start key is inclusive and the stop key is exclusive,
or use the inequality start <= match < stop.

joe

Mime
View raw message