Search code examples
cassandrahector

Get data in a specific time interval from Cassandra DB using Hector Api


I'm new to cassandra database. I'm using hector api to extract data from a cassandra 1.2.11 DB using RangeSlicesQuery and i'm successfully able to get from the database. The primary key of the table which i'm querying is in LexicalUUID and i can't change it to time based UUIDs as i'm not allowed to change the DB structure by my client. There is also a column which stores time in epoch type Integer in that table and I want to query the DB based on that time for a specific time interval. Can anyone guide me how I can do that using the hector api as the time column is not the table key?


Solution

  • I think I might have found the answer to my question. I have yet to test this but i think if I use IndexedSlicesQuery instead of RangeSlicesQuery as it has special methods to add expressions for equals, greater and less than.etc. If anyone else faces the same problem then consult the following links for both documentation and some examples:

    Why use IndexedSlicesQuery instead of RangeSlicesQuery

    IndexedSlicesQuery Documentation

    Examples