Details
Description
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',
And the output is:
ddd/c1:q1/value1
ddd/c1:q2/value2
ccc/c1:q1/value1
ccc/c1:q2/value2
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.
Attachments
Attachments
Issue Links
- incorporates
-
HBASE-11154 Document how to use Reverse Scan API
- Closed
- is related to
-
HBASE-9999 Add support for small reverse scan
- Closed
- relates to
-
HBASE-10016 Make use of backward seek implemented in reverse scan support for range queries.
- Closed
-
HBASE-10421 Investigate scan performance in 0.96 and later
- Closed