You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Pavel Lysov <pa...@gmail.com> on 2008/07/23 21:30:36 UTC

backward scanner or other ways to do pagination

Hi guys!

It seems I'll need to be able to paginate over table contents. I'll  
need to get items starting from most recent and going past. Is there a  
good way to achieve that? Since the keys are sorted (I use timestamps  
as keys in the table), I thought about some kind of reverse scanner  
that would cycle through the items 999 to 111 - that would help with  
the pagination requirement. Though I see nothing like that in the  
hbase sources.

Could you please advice how to paginate? :)

Thank you!

Pavel Lysov
pavlikus@gmail.com




Re: backward scanner or other ways to do pagination

Posted by Pavel Lysov <pa...@gmail.com>.
Nice, thanks Jean-Daniel.
P.

> Pavel,
>
> You could reverse the keys instead of reversing the scanner. Something
> "Long.MAX_VALUE - timestamp" and padded with zeros just in case.
>
> Hope it helps,
>
> J-D
>
> On Wed, Jul 23, 2008 at 3:30 PM, Pavel Lysov <pa...@gmail.com>  
> wrote:
>
>> Hi guys!
>>
>> It seems I'll need to be able to paginate over table contents. I'll  
>> need to
>> get items starting from most recent and going past. Is there a good  
>> way to
>> achieve that? Since the keys are sorted (I use timestamps as keys  
>> in the
>> table), I thought about some kind of reverse scanner that would cycle
>> through the items 999 to 111 - that would help with the pagination
>> requirement. Though I see nothing like that in the hbase sources.
>>
>> Could you please advice how to paginate? :)
>>
>> Thank you!
>>
>> Pavel Lysov
>> pavlikus@gmail.com
>>
>>
>>
>>

Pavel Lysov
pavlikus@gmail.com




Re: backward scanner or other ways to do pagination

Posted by Jean-Daniel Cryans <jd...@gmail.com>.
Pavel,

You could reverse the keys instead of reversing the scanner. Something
"Long.MAX_VALUE - timestamp" and padded with zeros just in case.

Hope it helps,

J-D

On Wed, Jul 23, 2008 at 3:30 PM, Pavel Lysov <pa...@gmail.com> wrote:

> Hi guys!
>
> It seems I'll need to be able to paginate over table contents. I'll need to
> get items starting from most recent and going past. Is there a good way to
> achieve that? Since the keys are sorted (I use timestamps as keys in the
> table), I thought about some kind of reverse scanner that would cycle
> through the items 999 to 111 - that would help with the pagination
> requirement. Though I see nothing like that in the hbase sources.
>
> Could you please advice how to paginate? :)
>
> Thank you!
>
> Pavel Lysov
> pavlikus@gmail.com
>
>
>
>