0

Basically, I want older versions of the rows based on some event datetime in the row. Let's say every row represents some event with rows constantly updating until the event actually happens. I want to retrieve the state at a certain time before the (up front known) eventtime. Of course I could retrieve all the last versions, then loop over all the entries and calculate the relevant timestamp and query per row based on that, but is there a better way?

Somewhat similar to this question:

Timestamp Based Scans in HBase?

Indrajit Swain
  • 1,505
  • 1
  • 15
  • 22
Jan van der Vegt
  • 1,471
  • 12
  • 34
  • If you use `Get` API, yon could set the timestamp for the row you want to retrieve: https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Get.html#setTimeRange-long-long- – BrightFlow Apr 10 '18 at 07:10
  • But then I would have to loop over all the rows, first retrieve them, get the event timestamp, calculate the timestamp you are interested in and query for that row again. That seems very inefficient so my question was if there is a more direct way of doing this – Jan van der Vegt Apr 10 '18 at 11:24
  • Do you know the time range you want to retrieve? If it is, you could use `Get get = new Get(rowKey); get.setTimeRange(start_ts, end_ts);` Then HBase only retrieve versions between that time range. You will not loop through all versions. – BrightFlow Apr 10 '18 at 11:46
  • They are dependent on another column in the row, let's say I'm interested in 4 hours before the event, as an example the event column contains 16:00 then I want the timestamp to be 12:00, but for another row the event contains 14:00 I need the timestamp to be 10:00. This is different per row – Jan van der Vegt Apr 10 '18 at 14:05

0 Answers0