You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "chunhui shen (JIRA)" <ji...@apache.org> on 2013/08/30 03:17:52 UTC

[jira] [Comment Edited] (HBASE-4811) Support reverse Scan

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

chunhui shen edited comment on HBASE-4811 at 8/30/13 1:16 AM:
--------------------------------------------------------------

bq.Why do we need backwardSeek() if we also have reverse scanners and heaps?
Reverse scanners' reversed scaning is based on the backwardSeek(), backwardSeek() is a seek like reseek(), but it won't seek to the rows after seekKey.(See the detail javadoc of KeyValueScanner#backwardSeek from the patch)


bq.Is it reasonable if we say users should not care about 'hbase.client.reversedscanner.maxbyte.length'?
I will try to remove this flaw in next days
                
      was (Author: zjushch):
    bq.Why do we need backwardSeek() if we also have reverse scanners and heaps?
Reverse scanners' reversed scaning is based on the backwardSeek(), backwardSeek() is a seek like reseek(), but it only seek to the previous rows.(See the detail javadoc of KeyValueScanner#backwardSeek from the patch)


bq.Is it reasonable if we say users should not care about 'hbase.client.reversedscanner.maxbyte.length'?
I will try to remove this flaw in next days
                  
> Support reverse Scan
> --------------------
>
>                 Key: HBASE-4811
>                 URL: https://issues.apache.org/jira/browse/HBASE-4811
>             Project: HBase
>          Issue Type: New Feature
>          Components: Client
>    Affects Versions: 0.20.6, 0.94.7
>            Reporter: John Carrino
>            Assignee: chunhui shen
>             Fix For: 0.98.0
>
>         Attachments: 4811-0.94-v3.txt, 4811-trunk-v10.txt, 4811-trunk-v5.patch, HBase-4811-0.94.3modified.txt, HBase-4811-0.94-v2.txt, hbase-4811-trunkv11.patch, hbase-4811-trunkv12.patch, hbase-4811-trunkv13.patch, hbase-4811-trunkv14.patch, hbase-4811-trunkv15.patch, hbase-4811-trunkv16.patch, hbase-4811-trunkv17.patch, hbase-4811-trunkv18.patch, hbase-4811-trunkv19.patch, hbase-4811-trunkv1.patch, hbase-4811-trunkv4.patch, hbase-4811-trunkv6.patch, hbase-4811-trunkv7.patch, hbase-4811-trunkv8.patch, hbase-4811-trunkv9.patch
>
>
> Reversed scan means scan the rows backward. 
> And StartRow bigger than StopRow in a reversed scan.
> For example, for the following rows:
> aaa/c1:q1/value1
> aaa/c1:q2/value2
> bbb/c1:q1/value1
> bbb/c1:q2/value2
> ccc/c1:q1/value1
> ccc/c1:q2/value2
> ddd/c1:q1/value1
> ddd/c1:q2/value2
> eee/c1:q1/value1
> eee/c1:q2/value2
> you could do a reversed scan from 'ddd' to 'bbb'(exclude) like this:
> Scan scan = new Scan();
> scan.setStartRow('ddd');
> scan.setStopRow('bbb');
> scan.setReversed(true);
> for(Result result:htable.getScanner(scan)){
>  System.out.println(result);
> }
> Aslo you could do the reversed scan with shell like this:
> hbase> scan 'table',{REVERSED => true,STARTROW=>'ddd', STOPROW=>'bbb'}
> And the output is:
> ddd/c1:q1/value1
> ddd/c1:q2/value2
> ccc/c1:q1/value1
> ccc/c1:q2/value2
> NOTE: when setting reversed as true for a client scan, you must set the start row, else will throw exception. Through {@link Scan#createBiggestByteArray(int)},you could get a big enough byte array as the start row
> All the documentation I find about HBase says that if you want forward and reverse scans you should just build 2 tables and one be ascending and one descending.  Is there a fundamental reason that HBase only supports forward Scan?  It seems like a lot of extra space overhead and coding overhead (to keep them in sync) to support 2 tables.  
> I am assuming this has been discussed before, but I can't find the discussions anywhere about it or why it would be infeasible.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira