Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7B778108FD for ; Tue, 25 Mar 2014 04:39:20 +0000 (UTC) Received: (qmail 36702 invoked by uid 500); 25 Mar 2014 04:39:17 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 36114 invoked by uid 500); 25 Mar 2014 04:39:16 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 36104 invoked by uid 99); 25 Mar 2014 04:39:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2014 04:39:15 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of fancyerii@gmail.com designates 209.85.217.170 as permitted sender) Received: from [209.85.217.170] (HELO mail-lb0-f170.google.com) (209.85.217.170) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2014 04:39:10 +0000 Received: by mail-lb0-f170.google.com with SMTP id s7so4430310lbd.29 for ; Mon, 24 Mar 2014 21:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=DUCXEAV2YC10tN4973g7mV0AAaalrFpNTl/jFf3ouro=; b=O6EKy5gGyCuulms6pZGqs7kCc8g2BpLyZEw4nbP/bkisHHWQvtw9WcghZESskmDoyV nSE2Bnu/kHvmlTWz92m1kpiwtyDyD05pes125DpG1YBQ0nDi8w+fi85JzVqm9YJ/GRsC wNWphuMEQpucSj7tHSBP8izEIFgQugR755bgqgrCH5fOFqQJ8yaYKsIiRqCgrt0w1p7L I+HLGIgavtxJIxBRSWRcxRF1oCfOGlDnKcbf1SFZICjpI9SPa3y/bdI1gngrkIYCBzY2 yJrVGbrWevk+YpECL2gmrsKbMeQBEZCijwkhryGMzhYrdCLXi7yzRacixV7m9Um8Wk2R FJkA== MIME-Version: 1.0 X-Received: by 10.112.163.69 with SMTP id yg5mr26343657lbb.14.1395722329634; Mon, 24 Mar 2014 21:38:49 -0700 (PDT) Received: by 10.112.148.41 with HTTP; Mon, 24 Mar 2014 21:38:49 -0700 (PDT) In-Reply-To: References: Date: Tue, 25 Mar 2014 12:38:49 +0800 Message-ID: Subject: Re: how to calculate stop key for a scan? From: Li Li To: user@hbase.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org thanks. it should work for my use cases(append a char larger than any char used by md5), but I think prefixfilter is more better and can be used without worry about any details On Tue, Mar 25, 2014 at 12:33 PM, Esteban Gutierrez wrote: > Hello Li. > > Have you tried to do something as simple as appending ~ (ascii 7E, last > printable ascii symbol) at the end of the start key as the stop key? It > should work find for you: > > > hbase(main):001:0> put 't1', > '7fc56270e7a70fa81a5935b72eacbe297fc56270e7a70fa81a5935b72eacbe29', 'c1', > 'A' > hbase(main):002:0> put 't1', > '9d5ed678fe57bcca610140957afab5719d5ed678fe57bcca610140957afab571', 'c1', > 'B' > hbase(main):003:0> put 't1', > '7fc56270e7a70fa81a5935b72eacbe299d5ed678fe57bcca610140957afab571', 'c1', > 'AB' > hbase(main):004:0> scan 't1', > {STARTROW=>'7fc56270e7a70fa81a5935b72eacbe29', > ENDROW=>'7fc56270e7a70fa81a5935b72eacbe29~'} > ROW COLUMN+CELL > 7fc56270e7a70fa81a5935b72eacbe297fc56270e column=c1:, > timestamp=1395721490980, value=A > 7a70fa81a5935b72eacbe29 > 7fc56270e7a70fa81a5935b72eacbe299d5ed678f column=c1:, > timestamp=1395721814374, value=AB > e57bcca610140957afab571 > 2 row(s) in 0.0210 seconds > > > esteban. > > > > -- > Cloudera, Inc. > > > > On Mon, Mar 24, 2014 at 9:17 PM, Li Li wrote: > >> have you understand the question? how to get the 'next' string of a >> given string? >> >> On Tue, Mar 25, 2014 at 11:49 AM, haosdent wrote: >> > MD5(abc) = "900150983cd24fb0d6963f7d28e17f72" >> > So you could set startkey to "900150983cd24fb0d6963f7d28e17f72" and set >> > stopkey to "900150983cd24fb0d6963f7d28e17f73". >> > >> > >> > On Tue, Mar 25, 2014 at 11:45 AM, Li Li wrote: >> > >> >> sorry, I want to get all the rows startsWith k1 >> >> example: >> >> k1 k2 rowKey >> >> abc aaa -> MD5(abc)MD5(aaa) >> >> abc bbb -> MD5(abc)MD5(bbb) >> >> abd ddd -> MD5(abd)MD5(ddd) >> >> >> >> how to use scan to get all rows startswith abc >> >> >> >> On Tue, Mar 25, 2014 at 11:40 AM, haosdent wrote: >> >> >>I want to get all the rows equals k1. >> >> > >> >> > Use Get(MD5(k1)MD5(k1)) without set startkey and stopkey. >> >> > >> >> > >> >> > On Tue, Mar 25, 2014 at 11:36 AM, Li Li wrote: >> >> > >> >> >> I have two string as primary key(k1,k2) >> >> >> and my row key in hbase is MD5(k1)MD5(k1) >> >> >> I want to get all the rows equals k1.I can set startRowKey easily. >> >> >> But How can I calculate stopRowKey? >> >> >> is following correct? what if the last byte of md5 is 127? what about >> >> >> overflow? >> >> >> any tools for this? >> >> >> >> >> >> Scan scan=new Scan(); >> >> >> byte[] start=MD5(key1); >> >> >> scan.setStartRow(start); >> >> >> byte[] end=MD5(key1); >> >> >> end[end.length-1]++ >> >> >> scan.setStopRow(end); >> >> >> >> >> > >> >> > >> >> > >> >> > -- >> >> > Best Regards, >> >> > Haosdent Huang >> >> >> > >> > >> > >> > -- >> > Best Regards, >> > Haosdent Huang >>