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

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

I created this shell script to take away any remaining doubt about what the 
right stopRow value is:
{code}
#!/bin/bash -x

hbase shell << HBaseScript
create  'ScanTestHBASE11990', 'F'
put     'ScanTestHBASE11990', "\x12",                   'F:qualfier', 'value'
put     'ScanTestHBASE11990', "\x12\x12\xFF\xFE",       'F:qualfier', 'value'
put     'ScanTestHBASE11990', "\x12\x12\xFF\xFF",       'F:qualfier', 'value'
put     'ScanTestHBASE11990', "\x12\x12\xFF\xFF\x00",   'F:qualfier', 'value'
put     'ScanTestHBASE11990', "\x12\x12\xFF\xFF\x01",   'F:qualfier', 'value'
put     'ScanTestHBASE11990', "\x12\x13",               'F:qualfier', 'value'
put     'ScanTestHBASE11990', "\x12\x13\x00",           'F:qualfier', 'value'
put     'ScanTestHBASE11990', "\x12\x13\x00\x00",       'F:qualfier', 'value'
put     'ScanTestHBASE11990', "\x12\x14",               'F:qualfier', 'value'
put     'ScanTestHBASE11990', "\xFF\xFF\xFF\xFF\xFF",   'F:qualfier', 'value'
scan    'ScanTestHBASE11990', {STARTROW => "\x12\x12\xFF\xFF" , ENDROW => 
"\x12\x12\xFF\xFF\x00" }
scan    'ScanTestHBASE11990', {STARTROW => "\x12\x12\xFF\xFF" , ENDROW => 
"\x12\x13" }
disable 'ScanTestHBASE11990'
drop    'ScanTestHBASE11990'
HBaseScript
{code}

The output of the two scans:
{code}
scan    'ScanTestHBASE11990', {STARTROW => "\x12\x12\xFF\xFF" , ENDROW => 
"\x12\x12\xFF\xFF\x00" }
ROW                                                         COLUMN+CELL
 \x12\x12\xFF\xFF                                           column=F:qualfier, 
timestamp=1411051805182, value=value
1 row(s) in 0.0400 seconds
{code}

{code}
scan    'ScanTestHBASE11990', {STARTROW => "\x12\x12\xFF\xFF" , ENDROW => 
"\x12\x13" }
ROW                                                         COLUMN+CELL
 \x12\x12\xFF\xFF                                           column=F:qualfier, 
timestamp=1411051805182, value=value
 \x12\x12\xFF\xFF\x00                                       column=F:qualfier, 
timestamp=1411051805230, value=value
 \x12\x12\xFF\xFF\x01                                       column=F:qualfier, 
timestamp=1411051805256, value=value
3 row(s) in 0.0110 seconds
{code}



> 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