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 6CBE0C9F5 for ; Fri, 25 Jan 2013 05:16:22 +0000 (UTC) Received: (qmail 25376 invoked by uid 500); 25 Jan 2013 05:16:20 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 25294 invoked by uid 500); 25 Jan 2013 05:16:20 -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 25281 invoked by uid 99); 25 Jan 2013 05:16:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jan 2013 05:16:20 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dontariq@gmail.com designates 209.85.128.180 as permitted sender) Received: from [209.85.128.180] (HELO mail-ve0-f180.google.com) (209.85.128.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jan 2013 05:16:13 +0000 Received: by mail-ve0-f180.google.com with SMTP id cz11so1918715veb.11 for ; Thu, 24 Jan 2013 21:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=Ga8r7FCozS1LbbPMK9Nrxlh3DPn/AxuA0a/PkB7sh3I=; b=Z2VRkdck1yTNJ/Nb5IFBdQhIL4wykqlKhjUItRtM5rfhhu8m0yuDhawNyw+4VZUgLT PyY2tC8ymEMTp4Alm0Vzdm60++oY1e6IcD1TpDCc9aOalsB07g9wf2o0MNdTfHrsOXAq G9YFc8pAcj258d+DyWNxLeQMlVpN9Juoav1iFmilBe1zXC3/vTcP1O0EXfsTvks4WfjW iQ/DqFXt9g/8UG7QyWdHxxAbGgwa/eFGb+/cnlHyvKI3aC9HNIfO6rWWGqFrsr1IchdD lGk+hmwduxLJSBlciy3vg99fPa/6B3IHpv2MKP+aWfML1tc5d4zu8ywfawVnvieXvuZW 4Jjw== X-Received: by 10.220.119.200 with SMTP id a8mr4699750vcr.38.1359090952848; Thu, 24 Jan 2013 21:15:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.58.34.16 with HTTP; Thu, 24 Jan 2013 21:15:12 -0800 (PST) In-Reply-To: References: <0CE69E9126D0344088798A3B7F7F80863AEBECA8@SZXEML553-MBX.china.huawei.com> From: Mohammad Tariq Date: Fri, 25 Jan 2013 10:45:12 +0530 Message-ID: Subject: Re: paging results filter To: "user@hbase.apache.org" Content-Type: multipart/alternative; boundary=bcaec54eed5676443a04d41605e5 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec54eed5676443a04d41605e5 Content-Type: text/plain; charset=ISO-8859-1 Hello Toby, Sorry for the late reply. But, you have got appropriate answers from the pros :) Warm Regards, Tariq https://mtariq.jux.com/ cloudfront.blogspot.com On Fri, Jan 25, 2013 at 9:45 AM, ramkrishna vasudevan < ramkrishna.s.vasudevan@gmail.com> wrote: > @Toby > > If you wish to go the specified page you need to set the start row that > needs to come as part of that page. > So what i feel is implement a custom page filter and keep doing next() and > display only those records that suits the page you clicked. > and send them back to the client. Anyway the logic inside the filter > should keep track of the number of records that passed by till you reach > your concerned page and that should > be based on the number of records on a page. > > Regards > Ram > > On Fri, Jan 25, 2013 at 9:04 AM, Anoop Sam John > wrote: > > > @Toby > > > > You mean to say that you need a mechanism for directly jumping to a page. > > Say you are in page#1 (1-20) now and you want to jump to page#4(61-80).. > > Yes this is not there in PageFilter... > > The normal way of next page , next page will work fine as within the > > server the next() calls on the scanner works this way... > > > > -Anoop- > > ________________________________________ > > From: Toby Lazar [tlazar@gmail.com] > > Sent: Thursday, January 24, 2013 6:44 PM > > To: user@hbase.apache.org > > Subject: Re: paging results filter > > > > I don't see a way of specifying which page of resluts I want. For > example, > > if I want page 3 with page size of 20 (only results 41-60), I don't see > how > > PageFilter can be configued for that. Am I missing the obvious? > > > > Thanks, > > > > Toby > > > > On Thu, Jan 24, 2013 at 7:52 AM, Mohammad Tariq > > wrote: > > > > > I think you need > > > PageFilter< > > > > > > http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/filter/PageFilter.html > > > > > > > . > > > > > > HTH > > > > > > Warm Regards, > > > Tariq > > > https://mtariq.jux.com/ > > > cloudfront.blogspot.com > > > > > > > > > On Thu, Jan 24, 2013 at 6:20 PM, Toby Lazar wrote: > > > > > > > Hi, > > > > > > > > I need to create a client function that allows paging of scan results > > > > (initially return results 1-20, then click on page to to show results > > > > 21-40, 41-60, etc.) without needing to remember the start rowkey. I > > > > beleive that a filter would be far more efficient than implementing > the > > > > logic client-side. I couldn't find any OOTB filter for this > > > functionality > > > > so I wrote the class below. It seems to work fine for me, but can > > anyone > > > > comment if this approach makes sense? Is there another OOTB filter > > that > > > I > > > > can use instead? > > > > > > > > Thank you, > > > > > > > > Toby > > > > > > > > > > > > > > > > import java.io.DataInput; > > > > import java.io.DataOutput; > > > > import java.io.IOException; > > > > import org.apache.hadoop.hbase.filter.FilterBase; > > > > public class PageOffsetFilter extends FilterBase { > > > > private long startRowCount; > > > > private long endRowCount; > > > > > > > > private int count = 0; > > > > public PageOffsetFilter() { > > > > } > > > > > > > > public PageOffsetFilter(long pageNumber, long pageSize) { > > > > > > > > if(pageNumber<1) > > > > pageNumber=1; > > > > > > > > startRowCount = (pageNumber - 1) * pageSize; > > > > endRowCount = (pageSize * pageNumber)-1; > > > > } > > > > @Override > > > > public boolean filterAllRemaining() { > > > > return count > endRowCount; > > > > } > > > > @Override > > > > public boolean filterRow() { > > > > > > > > count++; > > > > if(count <= startRowCount) { > > > > return true; > > > > } else { > > > > return false; > > > > } > > > > > > > > } > > > > > > > > @Override > > > > public void readFields(DataInput dataInput) throws IOException { > > > > > > > > this.startRowCount = dataInput.readLong(); > > > > this.endRowCount = dataInput.readLong(); > > > > } > > > > @Override > > > > public void write(DataOutput dataOutput) throws IOException { > > > > dataOutput.writeLong(startRowCount); > > > > dataOutput.writeLong(endRowCount); > > > > } > > > > > > > > } > > > > > > > > > > --bcaec54eed5676443a04d41605e5--