cassandradatastaxcomparatorcqlshclustering-key

Define custom comparator for Cassandra's clustering column


Is there a way for me to use a custom comparator function for sorting the clustering key in cassandra.

My table definition is similar to following:

CREATE TABLE temp (user_id text, data_id int, data text, PRIMARY KEY(user_id, data_id));

Here, data_id will be used as the clustering column. I was wondering if I can define a custom comparator to dictate the order of data_id when written to disk.

Thanks for your help in advance :).


Solution

  • This currently is not supported in cassandra to the bes tof my knowledge.

    Please do refer to comments posted above to get an idea of what is the right approach.