[ 
https://issues.apache.org/jira/browse/HBASE-11990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14139351#comment-14139351
 ] 

Niels Basjes commented on HBASE-11990:
--------------------------------------

[~lhofhansl]: Yes, this would yield the same result (same rows). 
In at least two places the HBase book directs towards the startRow/stopRow 
solution to achieve this. 
This solution seems to me also to be the easiest to use for application 
developers.
Using a Filter would make things complex if the application needs filters as 
well.

Quote from http://hbase.apache.org/book/data_model_operations.html
{quote}
The following example shows how startRow and stopRow can be applied to a Scan 
instance to return the rows beginning with "row".
...
scan.setStartRow(Bytes.toBytes("row")); // start key is inclusive
scan.setStopRow(Bytes.toBytes("rox"));  // stop key is exclusive
{quote}

Quote from http://hbase.apache.org/book/client.filter.html
{quote}
9.4.5.1. RowFilter
It is generally a better idea to use the startRow/stopRow methods on Scan for 
row selection, however RowFilter can also be used.
{quote}



> Make setting the start and stop row for a specific prefix easier
> ----------------------------------------------------------------
>
>                 Key: HBASE-11990
>                 URL: https://issues.apache.org/jira/browse/HBASE-11990
>             Project: HBase
>          Issue Type: New Feature
>          Components: Client
>            Reporter: Niels Basjes
>         Attachments: 11990v4.txt, HBASE-11990-20140916-v2.patch, 
> HBASE-11990-20140916-v3.patch, HBASE-11990-20140916-v5.patch, 
> HBASE-11990-20140916-v6.patch, HBASE-11990-20140916.patch, 
> HBASE-11990-20140917-v7.patch
>
>
> If you want to set a scan from your application to scan for a specific row 
> prefix this is actually quite hard.
> As described in several places you can set the startRow to the prefix; yet 
> the stopRow should be set to the prefix '+1'
> If the prefix 'ASCII' put into a byte[] then this is easy because you can 
> simply increment the last byte of the array. 
> But if your application uses real binary rowids you may run into the scenario 
> that your prefix is something like 
> {code}{ 0x12, 0x23, 0xFF, 0xFF }{code} Then the increment should be {code}{ 
> 0x12, 0x24 }{code}
> I have prepared a proposed patch that makes setting these values correctly a 
> lot easier.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to