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 43427200B6F for ; Wed, 24 Aug 2016 21:03:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 41C70160AB1; Wed, 24 Aug 2016 19:03:04 +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 89984160A91 for ; Wed, 24 Aug 2016 21:03:03 +0200 (CEST) Received: (qmail 49996 invoked by uid 500); 24 Aug 2016 19:03:02 -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 49979 invoked by uid 99); 24 Aug 2016 19:03:02 -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, 24 Aug 2016 19:03:02 +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 94127CD0EF for ; Wed, 24 Aug 2016 19:03:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.879 X-Spam-Level: ** X-Spam-Status: No, score=2.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_REPLY=1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com 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 aaiQ2YknJnyF for ; Wed, 24 Aug 2016 19:03:00 +0000 (UTC) Received: from mail-yw0-f173.google.com (mail-yw0-f173.google.com [209.85.161.173]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 6CA165FBF9 for ; Wed, 24 Aug 2016 19:03:00 +0000 (UTC) Received: by mail-yw0-f173.google.com with SMTP id u134so15908402ywg.3 for ; Wed, 24 Aug 2016 12:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=SZ4gVOfV41c97vsFj2fZTFtPV3YDFECvoqrL6UOPSNQ=; b=nzXBc1eVKcRVegkYD/nH0Lf0ysxPXxaKTMuBrv/2lzde69mEC97P3PI9eemM2Wqfpf IUxLPrM9Bmr9XbzK1rezpH06YVAUgmw2DsQiAqYr39NLq7zvidv5NYLllNFWKpfBE1vd EtveTwVDyNfNkfkMogbPMYrJZB1nKvtmYWHWguTYekFEA/rrbjUg/KAQBXEcJR6cx1Ks A95juXEUI2WnnLuw9GT2Cf0n19UgQXeG9EYj3IftUc6Z73e7EOF8ODY7r5sPTzKVIl+J wNmE6v9W8jtf+e6tV7R7WE0efpNOp/+x1Y7kLD4tagJWg7dCYC7JRh+0Yq/BoQOvUfiB U98g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=SZ4gVOfV41c97vsFj2fZTFtPV3YDFECvoqrL6UOPSNQ=; b=h6E+53OsAnSsWAhrWdRj4/oRtep/76WhhE9BIj1gtH9Puv5SY/4CTpVtikRM5z78n8 Qg8xp5wFi7YoyBNrHILProbvuwpIU7gaj+tghtkYrIKNuWK0nN8xvcfERN5HFnG4ZdJi yewyTsJFYNBVG5I+lEo1jOAmiIN3YIBKE3mrt0J5gONFK0T5TcG3p0mwLUtgEdMrBNGY fOIfS9hLCTwwS9VGedRelEn2ivGrXfKZ0PBEneGZuD9fq543htG0FVsoz9U+9KErQ8qM wtCvM0/Rp4kiAr1+fMILmDH7rzvOCG97qF07iVdRRg1FPLK+MfwLARPV7bQEw6GwPS38 69Mg== X-Gm-Message-State: AE9vXwNuP9KEdwbEKbapKkKz3L3vpgKR+JGTPP8CxNo04DeRp0rDw2tQV05c3UQYrc+2vofTL5RnntSnA1iuZg== X-Received: by 10.13.214.214 with SMTP id y205mr3649652ywd.209.1472065374589; Wed, 24 Aug 2016 12:02:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.161.4 with HTTP; Wed, 24 Aug 2016 12:02:54 -0700 (PDT) In-Reply-To: References: From: Ted Yu Date: Wed, 24 Aug 2016 12:02:54 -0700 Message-ID: Subject: Re: How to Speed up Prefix scan on column qualifier To: "user@hbase.apache.org" Content-Type: multipart/alternative; boundary=94eb2c0758b2bd1833053ad5ed11 archived-at: Wed, 24 Aug 2016 19:03:04 -0000 --94eb2c0758b2bd1833053ad5ed11 Content-Type: text/plain; charset=UTF-8 Get is used to retrieve single row. If Get serves your need, you don't need PrefixFilter. On Wed, Aug 24, 2016 at 11:58 AM, Manjeet Singh wrote: > I am using 1.2.1 > > I have tried these but actually ResultScanner took long time > is their any way to use Get with filter? > HBase already exposed setFilter method on Get class but its not working > > On Wed, Aug 24, 2016 at 10:56 PM, Vladimir Rodionov < > vladrodionov@gmail.com> > wrote: > > > If you are on HBase 1.+ you can use > > > > Scan API: > > > > setRowPrefixFilter(byte[] rowPrefix) > > > > > > -Vlad > > > > On Wed, Aug 24, 2016 at 5:28 AM, Ted Yu wrote: > > > > > Please use the following API to set start row before calling > > > hTable.getScanner(scan): > > > > > > public Scan setStartRow(byte [] startRow) { > > > > > > On Wed, Aug 24, 2016 at 5:08 AM, Manjeet Singh < > > manjeet.chandhok@gmail.com > > > > > > > wrote: > > > > > > > Hi All, > > > > > > > > I have below code where I have row key like 9865327845_#RandomChar > > > > I want to perform prefix scan I tryed with ResultScanner which has > > > > performance impact > > > > I have seen in some articles people saying about Get and setFilter > but > > > its > > > > not working > > > > can anyone suggest me better way, below is my code > > > > > > > > public static HashSet getResultByPreFixFilterScan(String rowkeys){ > > > > Scan scan = new Scan(); > > > > PrefixFilter prefixFilter = new PrefixFilter(rowkeys.getBytes()); > > > > scan.setFilter(prefixFilter); > > > > ResultScanner resultScanner = null; > > > > try { > > > > resultScanner = hTable.getScanner(scan); > > > > } catch (IOException e) { > > > > // TODO Auto-generated catch block > > > > e.printStackTrace(); > > > > } > > > > > > > > HashSet rowKeySet=new HashSet(); > > > > //Result result = table.get(g); > > > > for (Result results : resultScanner) { > > > > for(KeyValue kv : results.raw()){ > > > > rowKeySet.add(new String(kv.getRow())); > > > > > > > > } > > > > } > > > > return rowKeySet; > > > > } > > > > > > > > > > > > > > > > > > > > > > > > can we perform prefix by > > > > Filter filter = new QualifierFilter(CompareFilter.CompareOp.EQUAL, > > new > > > > BinaryComparator(Bytes.toBytes(rowkeys))); > > > > > > > > Thanks > > > > Manjeet > > > > > > > > -- > > > > luv all > > > > > > > > > > > > > -- > luv all > --94eb2c0758b2bd1833053ad5ed11--