Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5B965200CAE for ; Wed, 21 Jun 2017 09:51:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5A4E7160BD0; Wed, 21 Jun 2017 07:51:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A0102160BE2 for ; Wed, 21 Jun 2017 09:51:15 +0200 (CEST) Received: (qmail 88091 invoked by uid 500); 21 Jun 2017 07:51:14 -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 87965 invoked by uid 99); 21 Jun 2017 07:51:14 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jun 2017 07:51:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id BAF68D4F87 for ; Wed, 21 Jun 2017 07:51:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.011 X-Spam-Level: X-Spam-Status: No, score=-100.011 tagged_above=-999 required=6.31 tests=[SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id LIQOR7TuvaLZ for ; Wed, 21 Jun 2017 07:51:13 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 564375FD5D for ; Wed, 21 Jun 2017 07:51:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id DD7C9E0D76 for ; Wed, 21 Jun 2017 07:51:03 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id A7D69240E3 for ; Wed, 21 Jun 2017 07:51:00 +0000 (UTC) Date: Wed, 21 Jun 2017 07:51:00 +0000 (UTC) From: "Hanjie Gu (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (HBASE-4811) Support reverse Scan MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 21 Jun 2017 07:51:16 -0000 [ https://issues.apache.org/jira/browse/HBASE-4811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16057114#comment-16057114 ] Hanjie Gu edited comment on HBASE-4811 at 6/21/17 7:50 AM: ----------------------------------------------------------- I am confused about the top Description. In my opinion reverse scan will output reversely, from bottom to up, starting from the point of start key. That is given the such 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 Shouldn't a reversed scan from 'ddd' to 'bbb'(exclude) output like this: ddd/c1:q2/value2 ddd/c1:q1/value1 ccc/c1:q2/value2 ccc/c1:q1/value1 However, the Description says like this: ddd/c1:q1/value1 ddd/c1:q2/value2 ccc/c1:q1/value1 ccc/c1:q2/value2 did it wrote error? or I have a misunderstand??? was (Author: jackgu): I am confused about the top Description. In my opinion reverse scan will output reversely, from bottom to up, starting from the point of start key. That is given the such 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 Shouldn't a reversed scan from 'ddd' to 'bbb'(exclude) output like this: ddd/c1:q2/value2 ddd/c1:q1/value1 ccc/c1:q2/value2 ccc/c1:q1/value1 ??? However, the Description says like this: ddd/c1:q1/value1 ddd/c1:q2/value2 ccc/c1:q1/value1 ccc/c1:q2/value2 did it wrote error? or I have a misunderstand? > 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-v22.txt, 4811-0.94-v23.txt, 4811-0.94-v25.txt, 4811-0.94-v3.txt, 4811-trunk-v10.txt, 4811-trunk-v29.patch, 4811-trunk-v5.patch, HBase-4811-0.94.3modified.txt, hbase-4811-0.94 v21.patch, hbase-4811-0.94-v24.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-trunkv24.patch, hbase-4811-trunkv24.patch, hbase-4811-trunkv25.patch, hbase-4811-trunkv26.patch, hbase-4811-trunkv27.patch, hbase-4811-trunkv28.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 > 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.4.14#64029)