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

Nick Dimiduk commented on HBASE-9763:
-------------------------------------

Perhaps I'm misunderstanding your example, but the trailing null-byte advice 
works as documented:

{noformat}
hbase(main):010:0> scan 't1', {STARTROW=>'aa'}
ROW                                                 COLUMN+CELL                 
                                                                                
                                          
 aa                                                 column=f:, 
timestamp=1381942385262, value=aa                                               
                                                           
 ab                                                 column=f:, 
timestamp=1381942391424, value=ab                                               
                                                           
 ac                                                 column=f:, 
timestamp=1381942396077, value=ac                                               
                                                           
 ad                                                 column=f:, 
timestamp=1381942400858, value=ad                                               
                                                           
 ae                                                 column=f:, 
timestamp=1381942405261, value=ae                                               
                                                           
 af                                                 column=f:, 
timestamp=1381942409758, value=af                                               
                                                           
6 row(s) in 0.0870 seconds

hbase(main):011:0> scan 't1', {STARTROW=>'aa', STOPROW=>'ae'}
ROW                                                 COLUMN+CELL                 
                                                                                
                                          
 aa                                                 column=f:, 
timestamp=1381942385262, value=aa                                               
                                                           
 ab                                                 column=f:, 
timestamp=1381942391424, value=ab                                               
                                                           
 ac                                                 column=f:, 
timestamp=1381942396077, value=ac                                               
                                                           
 ad                                                 column=f:, 
timestamp=1381942400858, value=ad                                               
                                                           
4 row(s) in 0.0510 seconds

hbase(main):012:0> scan 't1', {STARTROW=>'aa\x00', STOPROW=>'ae'}
ROW                                                 COLUMN+CELL                 
                                                                                
                                          
 ab                                                 column=f:, 
timestamp=1381942391424, value=ab                                               
                                                           
 ac                                                 column=f:, 
timestamp=1381942396077, value=ac                                               
                                                           
 ad                                                 column=f:, 
timestamp=1381942400858, value=ad                                               
                                                           
3 row(s) in 0.0350 seconds

hbase(main):013:0> scan 't1', {STARTROW=>'aa\x00', STOPROW=>'ae\x00'}
ROW                                                 COLUMN+CELL                 
                                                                                
                                          
 ab                                                 column=f:, 
timestamp=1381942391424, value=ab                                               
                                                           
 ac                                                 column=f:, 
timestamp=1381942396077, value=ac                                               
                                                           
 ad                                                 column=f:, 
timestamp=1381942400858, value=ad                                               
                                                           
 ae                                                 column=f:, 
timestamp=1381942405261, value=ae                                               
                                                           
4 row(s) in 0.0560 seconds
{noformat}

When the precise rowkey values are unknown, I recommend using the 
{{PrefixFilter}} and letting it sort things out.

> Scan javadoc doesn't fully capture semantics of start and stop row
> ------------------------------------------------------------------
>
>                 Key: HBASE-9763
>                 URL: https://issues.apache.org/jira/browse/HBASE-9763
>             Project: HBase
>          Issue Type: Bug
>          Components: documentation
>            Reporter: Gabriel Reid
>            Priority: Minor
>         Attachments: HBASE-9763.patch
>
>
> The current javadoc for Scan#setStartRow and Scan#setStopRow methods don't 
> accurately capture the semantics of the use of row prefix values. Both 
> methods describe the use of a trailing null byte to change the 
> inclusive/exclusive the respective semantics of setStartRow and setStopRow.
> The use of a trailing null byte for start row exclusion only works in the 
> case that exact full matching is done on row keys. The use of a trailing null 
> byte for stop row inclusion has even more limitations (see HBASE-9035).
> The basic example is having the following rows:
> {code}
> AAB
> ABB
> BBC
> BCC
> {code}
> Setting the start row to A and the stop row to B will include AAB and AB. 
> Setting the start row to A\x0 and the stop row to B\x0 will result in the 
> same two rows coming out of the scan, instead of having an effect on the 
> inclusion/exclusion semantics.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to