hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manjeet Singh <manjeet.chand...@gmail.com>
Subject Re: How to get Last 1000 records from 1 millions records
Date Thu, 25 Aug 2016 08:46:23 GMT
Hi All

I have one another question for same case

below is my sample Hbase data  as we all know that hbase store data on the
basis of rowkey (sorted)
below is IP as we can see 2.168.129.81_1 is in last what I am expecting it
shuld come just after 1.168.129.81_2



 1.168.129.81_0
 column=c2:D_com.stackoverflow/questions/4, timestamp=1472104396288, value=4
 1.168.129.81_1
 column=c2:D_com.stackoverflow/questions/1, timestamp=1472104396288, value=1
 1.168.129.81_1
 column=c2:D_com.stackoverflow/questions/2, timestamp=1472104396288, value=2
 1.168.129.81_2
 column=c2:D_com.stackoverflow/questions/0, timestamp=1472104396288, value=0
 192.168.129.81_1
 column=c2:D_com.stackoverflow/questions/2, timestamp=1472104386671, value=2
 192.168.129.81_1
 column=c2:D_com.stackoverflow/questions/4, timestamp=1472104386671, value=4
 192.168.129.81_2
 column=c2:D_com.stackoverflow/questions/1, timestamp=1472104386671, value=1
 192.168.129.81_3
 column=c2:D_com.stackoverflow/questions/0, timestamp=1472104386671, value=0
 192.168.129.81_3
 column=c2:D_com.stackoverflow/questions/3, timestamp=1472104386671, value=3
 2.168.129.81_1
 column=c2:D_com.stackoverflow/questions/0, timestamp=1472104404609, value=0
 2.168.129.81_1
 column=c2:D_com.stackoverflow/questions/1, timestamp=1472104404609, value=1
 2.168.129.81_1
 column=c2:D_com.stackoverflow/questions/2, timestamp=1472104404609, value=2
 2.168.129.81_3
 column=c2:D_com.stackoverflow/questions/4, timestamp=1472104404609, value=4



On Thu, Aug 25, 2016 at 12:36 PM, Manjeet Singh <manjeet.chandhok@gmail.com>
wrote:

> I am using some logical salt say I have mobile number in my row key so I
> am using some algo and fitting this mobile number into some ASCII char
> So each time I know what will be the salt so its clear to me and it will
> never change the order
> example
> if based on my algo I get A for 9811111111
> so each time it will always return me A for 9811111111
> so if I have my row key Like
> A_9811111111_101
> A_9811111111_102
> A_9811111111_103
> A_9811111111_104
> A_9811111111_105
> A_9811111111_106
> A_9811111111_107
> A_9811111111_108
>
> it will sort my row key in same manner as showing above now these are
> millions of record now i want to get last 10000 records
> is their any way to get it, my concern is to perform all calcuation on
> server side not client side.
>
>
> Thanks
> Manjeet
>
>
> On Thu, Aug 25, 2016 at 1:06 AM, Esteban Gutierrez <esteban@cloudera.com>
> wrote:
>
>> As long as new rows are added to the latest region that "might" work. But
>> if the table is using hashed keys or rows are added randomly to the table
>> then retrieving the last million will be trickier and you will have to
>> scan
>> based on timestamp (if not modified) and then filter one more time.
>>
>> esteban.
>>
>>
>> --
>> Cloudera, Inc.
>>
>>
>> On Wed, Aug 24, 2016 at 12:31 PM, Ted Yu <yuzhihong@gmail.com> wrote:
>>
>> > The following API should help in your case:
>> >
>> >   public Scan setReversed(boolean reversed) {
>> >
>> > Cheers
>> >
>> > On Wed, Aug 24, 2016 at 12:05 PM, Manjeet Singh <
>> > manjeet.chandhok@gmail.com>
>> > wrote:
>> >
>> > > Hi all
>> > >
>> > > Hbase didnt provide sorting on column but rowkey store in sorted form
>> > > like small value first and greater value last
>> > >
>> > > example
>> > > 1
>> > > 2
>> > > 3
>> > > 4
>> > > 5
>> > > 6
>> > > 7
>> > > and so on
>> > >
>> > > Assume I have 1 Miilions record but i want to look last 1000 records
>> only
>> > > Is their any way to do this? I don't want to perform any calculation
>> on
>> > > client side so may be any filter can help on it?
>> > >
>> > > Thanks
>> > > Manjeet
>> > >
>> > > --
>> > > luv all
>> > >
>> >
>>
>
>
>
> --
> luv all
>



-- 
luv all

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