hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Meyn <oliver.m...@zerofootprint.net>
Subject how to get the row before this one?
Date Fri, 28 May 2010 16:01:34 GMT
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

Mime
View raw message