hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From y_823...@tsmc.com
Subject Re: how to get the row before this one?
Date Tue, 01 Jun 2010 01:16:53 GMT
I am very curious about what kind of project you are going on.

Fleming Chiu(邱宏明)
週一無肉日吃素救地球(Meat Free Monday Taiwan)

|         |           Oliver Meyn         |
|         |           <oliver.meyn@zerofoo|
|         |           tprint.net>         |
|         |                               |
|         |           2010/05/31 09:28 PM |
|         |           Please respond to   |
|         |           user                |
|         |                               |
  |       To:      user@hbase.apache.org                                                 
  |       cc:      (bcc: Y_823910/TSMC)                                                  
  |       Subject: Re: how to get the row before this one?                               

Nice!  I thought of this approach but couldn't figure out how to get
Hbase to sort in reverse, and so gave up.  But I was clearly too much
"inside the box" :)


On 30-May-10, at 5:49 PM, Igor Ranitovic wrote:

> One thing that I can think of is to sort measurements from the
> newest to oldest:
> DevA,12pm,150W
> DevA,9am,100W
> Now instead of scanning from-to date, start with the to date and
> keep scanning until you find a row with a date that is older than
> the from date.
> To use your example, start the scan from 1pm and stop when you hit
> 9am.
> To sort row from newest to oldest use MAXINT - timestamp, where
> timestamp is seconds since epoch.
> Hope this helps.
> i.
> Oliver Meyn wrote:
>> Hi all,
>> I have a table "device_power" which has as its row key
>> "device_id.timestamp", and a single column, "power".  A new row is
>> written whenever the power consumption of a device changes, which
>> could be every second, or could be as much as days.
>> When I do a query like "what was the average power of device X
>> between Date 1 and Date 2" I can get all keys where device_id
>> matches X (using PrefixFilter) and timestamp > Date1 and < Date2
>> (using either RowFilter or setTimeRange).  But I also need the last
>> row before my time range to know what state the device was in at
>> the start of my query period.  Maybe an example will help make it
>> more obvious (my timestamps are long integers, but this is easier
>> to read):
>> DevA.9am, 100W
>> DevB.10am, 200W
>> DevB.11am, 150W
>> DevA.12pm, 150W
>> And now the query "What was the average power of DevA btw 10am and
>> 1pm".  Is there a clever way to "get the first row before 10am that
>> matches PrefixFilter("DevA") ?
>> Thanks,
>> Oliver

Oliver Meyn
Software Architect
Zerofootprint Software, Inc.
(416) 365-7557 x144

                                                         TSMC PROPERTY       
 This email communication (and any attachments) is proprietary information   
 for the sole use of its                                                     
 intended recipient. Any unauthorized review, use or distribution by anyone  
 other than the intended                                                     
 recipient is strictly prohibited.  If you are not the intended recipient,   
 please notify the sender by                                                 
 replying to this email, and then delete this email and any copies of it     
 immediately. Thank you.                                                     

View raw message