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 80EA9107D0 for ; Tue, 25 Mar 2014 03:49:55 +0000 (UTC) Received: (qmail 68923 invoked by uid 500); 25 Mar 2014 03:49:49 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 68538 invoked by uid 500); 25 Mar 2014 03:49:46 -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 68520 invoked by uid 99); 25 Mar 2014 03:49:45 -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 03:49:45 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of haosdent@gmail.com designates 209.85.219.48 as permitted sender) Received: from [209.85.219.48] (HELO mail-oa0-f48.google.com) (209.85.219.48) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2014 03:49:39 +0000 Received: by mail-oa0-f48.google.com with SMTP id m1so7034427oag.35 for ; Mon, 24 Mar 2014 20:49:17 -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=DUXB+sOR1+dtsCWlcvxtOMgwiZlXzm+1e+nizLxhCP4=; b=pdxqX8wYcuRq+v1NRbfZ2mCFXiVL1p7wn3yz6QuQn9fGigy2DFM6axtAfXWamZJLG6 WONs4vxRRPxFHVd1airjY+k/J9FRLP5sPkkIlMUSkzSe5HBlb8L0ow+7r9eR7SRNRk8s yhvlmWPchkHQnFR07/YG7CYQLvEDA0MStW1BV2f1i4DQR7GU9d3vYpisHRd9uz0YRE1K 9Zqm8WcXbouQ6jhRg3fDZI2moxR8yzHkM+Vqq1jV97wLpcjFNPMcL00J/5rtCqql6CX2 SkA8hYwt5RQRFCiWS9x585+wUQEn6wG4Eia8A1GyckK+Xc6FFFGdnBsPqE51ifLSiY1+ NxHw== MIME-Version: 1.0 X-Received: by 10.182.34.196 with SMTP id b4mr30193295obj.13.1395719357653; Mon, 24 Mar 2014 20:49:17 -0700 (PDT) Received: by 10.182.60.166 with HTTP; Mon, 24 Mar 2014 20:49:17 -0700 (PDT) In-Reply-To: References: Date: Tue, 25 Mar 2014 11:49:17 +0800 Message-ID: Subject: Re: how to calculate stop key for a scan? From: haosdent To: hbase-user Content-Type: multipart/alternative; boundary=001a11c2cba484e9fa04f5663c4a X-Virus-Checked: Checked by ClamAV on apache.org --001a11c2cba484e9fa04f5663c4a Content-Type: text/plain; charset=ISO-8859-1 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 --001a11c2cba484e9fa04f5663c4a--