You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by vishnupriyaa <vp...@gmail.com> on 2012/05/24 14:50:36 UTC
Pagination in hbase
Hi,
In my hbase table I have around 10000 data ,need to fetch first 100 then
next 100 row like that.How can I run a java code to fetch like that, by
setting limit and offset.
--
View this message in context: http://old.nabble.com/Pagination-in-hbase-tp33901703p33901703.html
Sent from the HBase User mailing list archive at Nabble.com.
RE: Pagination in hbase
Posted by vishnupriyaa <vp...@gmail.com>.
hi,
how can I set the offset value.I have added some filters to get the
records,it returns more than 10000 rows and need to get first 100 data the
next 100.Can you give some sample java code.
Srikanth P. Shreenivas wrote:
>
> Look at
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#setCaching(int)
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#setBatch(int)
>
> Regards,
> Srikanth
>
> -----Original Message-----
> From: vishnupriyaa [mailto:vpatoffice@gmail.com]
> Sent: Thursday, May 24, 2012 6:21 PM
> To: hbase-user@hadoop.apache.org
> Subject: Pagination in hbase
>
>
> Hi,
>
> In my hbase table I have around 10000 data ,need to fetch first 100 then
> next 100 row like that.How can I run a java code to fetch like that, by
> setting limit and offset.
>
> --
> View this message in context:
> http://old.nabble.com/Pagination-in-hbase-tp33901703p33901703.html
> Sent from the HBase User mailing list archive at Nabble.com.
>
>
> ________________________________
>
> http://www.mindtree.com/email/disclaimer.html
>
>
--
View this message in context: http://old.nabble.com/Pagination-in-hbase-tp33901703p33901808.html
Sent from the HBase User mailing list archive at Nabble.com.
Re: Pagination in hbase
Posted by Mohammad Tariq <do...@gmail.com>.
you can use Hbase PageFilter api to achieve this.
Regards,
Mohammad Tariq
On Thu, May 24, 2012 at 6:43 PM, shashwat shriparv
<dw...@gmail.com> wrote:
> Check out this link :
>
> http://www.360doc.com/content/09/1215/22/454430_11218539.shtml
>
>
> or you can try this also
>
>
> Filter filter = new PageFilter(15);
> int totalRows = 0;
> byte[] lastRow = null;
> while (true) {
> Scan scan = new Scan();
> scan.setFilter(filter);
> if (lastRow != null) {
> byte[] startRow = Bytes.add(lastRow, POSTFIX);
> System.out.println("start row: " +
> Bytes.toStringBinary(startRow));
> scan.setStartRow(startRow);
> }
> ResultScanner scanner = table.getScanner(scan);
> int localRows = 0;
> Result result;
> while ((result = scanner.next()) != null) {
> System.out.println(localRows++ + ": " + result);
> totalRows++;
> lastRow = result.getRow();
> }
> scanner.close();
> if (localRows == 0) break;
> }
> System.out.println("total rows: " + totalRows);
>
> On Thu, May 24, 2012 at 6:24 PM, Srikanth P. Shreenivas <
> Srikanth_Shreenivas@mindtree.com> wrote:
>
>> Look at
>>
>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#setCaching(int)
>>
>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#setBatch(int)
>>
>> Regards,
>> Srikanth
>>
>> -----Original Message-----
>> From: vishnupriyaa [mailto:vpatoffice@gmail.com]
>> Sent: Thursday, May 24, 2012 6:21 PM
>> To: hbase-user@hadoop.apache.org
>> Subject: Pagination in hbase
>>
>>
>> Hi,
>>
>> In my hbase table I have around 10000 data ,need to fetch first 100 then
>> next 100 row like that.How can I run a java code to fetch like that, by
>> setting limit and offset.
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Pagination-in-hbase-tp33901703p33901703.html
>> Sent from the HBase User mailing list archive at Nabble.com.
>>
>>
>> ________________________________
>>
>> http://www.mindtree.com/email/disclaimer.html
>>
>
>
>
> --
>
>
> ∞
> Shashwat Shriparv
Re: Pagination in hbase
Posted by shashwat shriparv <dw...@gmail.com>.
Check out this link :
http://www.360doc.com/content/09/1215/22/454430_11218539.shtml
or you can try this also
Filter filter = new PageFilter(15);
int totalRows = 0;
byte[] lastRow = null;
while (true) {
Scan scan = new Scan();
scan.setFilter(filter);
if (lastRow != null) {
byte[] startRow = Bytes.add(lastRow, POSTFIX);
System.out.println("start row: " +
Bytes.toStringBinary(startRow));
scan.setStartRow(startRow);
}
ResultScanner scanner = table.getScanner(scan);
int localRows = 0;
Result result;
while ((result = scanner.next()) != null) {
System.out.println(localRows++ + ": " + result);
totalRows++;
lastRow = result.getRow();
}
scanner.close();
if (localRows == 0) break;
}
System.out.println("total rows: " + totalRows);
On Thu, May 24, 2012 at 6:24 PM, Srikanth P. Shreenivas <
Srikanth_Shreenivas@mindtree.com> wrote:
> Look at
>
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#setCaching(int)
>
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#setBatch(int)
>
> Regards,
> Srikanth
>
> -----Original Message-----
> From: vishnupriyaa [mailto:vpatoffice@gmail.com]
> Sent: Thursday, May 24, 2012 6:21 PM
> To: hbase-user@hadoop.apache.org
> Subject: Pagination in hbase
>
>
> Hi,
>
> In my hbase table I have around 10000 data ,need to fetch first 100 then
> next 100 row like that.How can I run a java code to fetch like that, by
> setting limit and offset.
>
> --
> View this message in context:
> http://old.nabble.com/Pagination-in-hbase-tp33901703p33901703.html
> Sent from the HBase User mailing list archive at Nabble.com.
>
>
> ________________________________
>
> http://www.mindtree.com/email/disclaimer.html
>
--
∞
Shashwat Shriparv
Re: Pagination in hbase
Posted by Doug Meil <do...@explorysmedical.com>.
Hi there-
This tooŠ
http://hbase.apache.org/book.html#scan
Š you can do what you want by using the start/stop rows.
On 5/24/12 8:54 AM, "Srikanth P. Shreenivas"
<Sr...@mindtree.com> wrote:
>Look at
>http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#s
>etCaching(int)
>http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#s
>etBatch(int)
>
>Regards,
>Srikanth
>
>-----Original Message-----
>From: vishnupriyaa [mailto:vpatoffice@gmail.com]
>Sent: Thursday, May 24, 2012 6:21 PM
>To: hbase-user@hadoop.apache.org
>Subject: Pagination in hbase
>
>
>Hi,
>
> In my hbase table I have around 10000 data ,need to fetch first 100 then
>next 100 row like that.How can I run a java code to fetch like that, by
>setting limit and offset.
>
>--
>View this message in context:
>http://old.nabble.com/Pagination-in-hbase-tp33901703p33901703.html
>Sent from the HBase User mailing list archive at Nabble.com.
>
>
>________________________________
>
>http://www.mindtree.com/email/disclaimer.html
>
RE: Pagination in hbase
Posted by "Srikanth P. Shreenivas" <Sr...@mindtree.com>.
Look at
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#setCaching(int)
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#setBatch(int)
Regards,
Srikanth
-----Original Message-----
From: vishnupriyaa [mailto:vpatoffice@gmail.com]
Sent: Thursday, May 24, 2012 6:21 PM
To: hbase-user@hadoop.apache.org
Subject: Pagination in hbase
Hi,
In my hbase table I have around 10000 data ,need to fetch first 100 then next 100 row like that.How can I run a java code to fetch like that, by setting limit and offset.
--
View this message in context: http://old.nabble.com/Pagination-in-hbase-tp33901703p33901703.html
Sent from the HBase User mailing list archive at Nabble.com.
________________________________
http://www.mindtree.com/email/disclaimer.html