0
votes

So far, I have been defining the Comparator (which specifies the data type of a Column Name) at the same time when creating Column Family and all the Columns in the family use that same Comparator Data Type.

[default@Voting] create column family User with comparator = UTF8Type;

I want to have Columns with different Comparator Data types in a column family.

My Question is this: Is it possible to specify Comparator when defining the meta data for individual Columns in the same way the validation_class for that Column in defined?

E.g.

update column family User with column_metadata = [{column_name: firstName, validation_class: UTF8Type}];
1

1 Answers

2
votes

The comparator tells Cassandra how to sort the column names, not the values. So it would be impossible to have multiple comparators in a column family. You may be confusing them with validators, which enforce data typing. You can specify your validator in the column metadata.

...
with column_metadata = [
  {column_name: firstName, validation_class: UTF8Type}
  ...
];