Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C3D8110E93 for ; Sun, 29 Sep 2013 05:22:38 +0000 (UTC) Received: (qmail 69447 invoked by uid 500); 29 Sep 2013 05:22:31 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 69212 invoked by uid 500); 29 Sep 2013 05:22:31 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 68600 invoked by uid 99); 29 Sep 2013 05:22:30 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Sep 2013 05:22:30 +0000 Date: Sun, 29 Sep 2013 05:22:30 +0000 (UTC) From: "Lars Hofhansl (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-4811) Support reverse Scan MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-4811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13781255#comment-13781255 ] Lars Hofhansl commented on HBASE-4811: -------------------------------------- Thanks [~zjushch]. Will run some perf tests on normal scans. If there're no new performance issues, let's commit to 0.94+. [~apurtell], [~tedyu@apache.org], [~stack], agreed? > 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 v21.patch, 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-trunkv20.patch, hbase-4811-trunkv21.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 was sent by Atlassian JIRA (v6.1#6144)