Keeping sorted values in a column family

83 views Asked by At

I need data to be sorted in a column family. While discovering about Cassandra I found clustering order by option for column family. But while creating column families dynamically I am unable to set this option.

Via cqlsh when I run

CREATE TABLE con1(day timestamp,ts timestamp,value double, PRIMARY KEY(day,ts))
  WITH CLUSTERING ORDER BY (ts DESC);

it stores ts values as sorted.

When I create a column family via Hector dynamically, it defaults to compact storage. I am unable to define clustering order by using Hector.

Any solution for this problem?

Is there any other way to keep values sorted in column family?

1

There are 1 answers

0
jbellis On

Use the native CQL Java driver instead of Hector: https://github.com/datastax/java-driver