Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - Pagination with HBase - getting previous page of data


Copy link to this message
-
Re: Pagination with HBase - getting previous page of data
Mohammad Tariq 2013-01-25, 05:12
Hello sir,

      While paging through, store the startkey of the current page of 25
rows
in a separate byte[]. Now, if you want to come back to this page when you
are at the next page do a range query where  startkey would be the rowkey
you had stored earlier and the endkey would be the startrowkey  of  current
page. You have to store just one rowkey each time you show a page using
which you could come back to this page when you are at the next page.

However, this approach will fail in a case where your user would like to go
to a particular previous page.

Warm Regards,
Tariq
https://mtariq.jux.com/
cloudfront.blogspot.com
On Fri, Jan 25, 2013 at 10:28 AM, Vijay Ganesan <[EMAIL PROTECTED]> wrote:

> I'm displaying rows of data from a HBase table in a data grid UI. The grid
> shows 25 rows at a time i.e. it is paginated. User can click on
> Next/Previous to paginate through the data 25 rows at a time. I can
> implement Next easily by setting a HBase
> org.apache.hadoop.hbase.filter.PageFilter and setting startRow on the
> org.apache.hadoop.hbase.client.Scan to be the row id of the next batch's
> row that is sent to the UI with the previous batch. However, I can't seem
> to be able to do the same with Previous. I can set the endRow on the Scan
> to be the row id of the last row of the previous batch but since HBase
> Scans are always in the forward direction, there is no way to set a
> PageFilter that can get 25 rows ending at a particular row. The only option
> seems to be to get *all* rows up to the end row and filter out all but the
> last 25 in the caller, which seems very inefficient. Any ideas on how this
> can be done efficiently?
>
> --
> -Vijay
>