0
votes

I still don't understand how should I code to make a RangedSliceQuery with a composite key. The other questions around aren't too generic.

The primary key in my table is PRIMARY KEY (Year int, Month int, DayofMonth int, UniqueCarrier varchar, FlightNum int)) and there are 20 other columns. How should I create the Composite variable ? How should I set the start and the end? My objective is to paginate through the table using RangedSliceQuery.

1

1 Answers

0
votes

Since it looks like you're using CQL to define the Key, this creates a composite CQL key, not a composite Cassandra key. The RangedSliceQuery will use the Cassandra (storage level) key, which according to this post, will be the first element of the primary key. So that would affect how you do a RangeQuery in Hector. That blog post also describes CQL queries for the data, which you might be able to use in your situation as well.

If you create a schema where the Cassandra key is a Composite, then you would choose your start and end values just like any other schema, just that the type is Composite. How you iterate through the keys is affected by which Partitioning you choose, Order Preserving (OPP) or Random (RP).