hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shashwat shriparv <dwivedishash...@gmail.com>
Subject Re: Pagination in hbase
Date Thu, 24 May 2012 13:13:10 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message