Return-Path: X-Original-To: apmail-hbase-dev-archive@www.apache.org Delivered-To: apmail-hbase-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1E6B71141E for ; Tue, 16 Sep 2014 08:16:44 +0000 (UTC) Received: (qmail 94989 invoked by uid 500); 16 Sep 2014 08:16:43 -0000 Delivered-To: apmail-hbase-dev-archive@hbase.apache.org Received: (qmail 94906 invoked by uid 500); 16 Sep 2014 08:16:43 -0000 Mailing-List: contact dev-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list dev@hbase.apache.org Received: (qmail 94895 invoked by uid 99); 16 Sep 2014 08:16:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Sep 2014 08:16:42 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.214.169] (HELO mail-ob0-f169.google.com) (209.85.214.169) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Sep 2014 08:16:36 +0000 Received: by mail-ob0-f169.google.com with SMTP id wm4so1847731obc.14 for ; Tue, 16 Sep 2014 01:16:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:date:message-id:subject:from :to:content-type; bh=2OkM5SsTdVHqaqSs12jy7XhbO6XopOFp5qjnEp6uKgw=; b=IMbXqcPkrWgznUSq7yTdrf2Psv4M4Pci+t0UeMVi7OaO72zegdUxvK3rH0VhxvWcBC V0O5tMBizp4ClYBVZDFdnfsJ+05X4RqSkX/wGAvZRzEUxZTwXEM7PU36KC0t0sG0RNfj 6vikQ6IUfxd4WSP9FKzLlalSvh24Y7mK2LQpsU7dwwx+vHNE7D0H5TFHhB5r7BL2qGO7 tZLSJEDIl+GZzq6Ri16i/kYZ6azdn3OF9yE6TB7s/dj1g0o5ClXvLvYMSFhYFE8JnSyV /YMiUT/YAYUyFiNm81p3Fzz8YB2YizMRB7qOba04ZUKJWNP4yNj+04pABo2KXfkkRNL4 uymQ== X-Gm-Message-State: ALoCoQm5bFL6GU2dLxjEHKJ7Ed8yYEsBesLLHMq0N7sH41ZYYMpPEQUYLKUQE08LvB/amrs/YffH MIME-Version: 1.0 X-Received: by 10.60.103.198 with SMTP id fy6mr10155439oeb.6.1410855374766; Tue, 16 Sep 2014 01:16:14 -0700 (PDT) Sender: niels@basj.es Received: by 10.76.128.38 with HTTP; Tue, 16 Sep 2014 01:16:14 -0700 (PDT) X-Originating-IP: [171.33.133.58] Date: Tue, 16 Sep 2014 10:16:14 +0200 X-Google-Sender-Auth: b23c67pxOpR6oqJxbH02j_9GFVM Message-ID: Subject: Scanning for a rowkey prefix. From: Niels Basjes To: dev@hbase.apache.org Content-Type: multipart/alternative; boundary=089e011831f271605005032a5d99 X-Virus-Checked: Checked by ClamAV on apache.org --089e011831f271605005032a5d99 Content-Type: text/plain; charset=UTF-8 Hi, I found that in several scenarios where I use HBase I need to scan for a specific rowkey prefix. (The prefix filter is too inefficient in my scenarios because it scans all rows and filters them) The way I do that is by using the scan.setStartRow and the scan.setStopRow But because these stoprow must be 'one bigger' I created a utility method for my own projects looks like this: private void scanForPrefix(Scan scan, byte[] prefix) { // Start the scan with the exact prefix scan.setStartRow(prefix); // Stop at the end of this prefix (= this prefix +1) byte[] endOfScan = prefix.clone(); endOfScan[endOfScan.length-1]++; scan.setStopRow(endOfScan); } Would it make sense to add this method the Scan class so you can simply say scan.setRowKeyPrefix(prefix) I you think this would make sense then I'll create a Jira ticket and submit a patch. -- Best regards Niels Basjes --089e011831f271605005032a5d99--