Database Reference
In-Depth Information
This generates an error because changing the comparator type is
not allowed (see
Figure 2-19
).
Figure 2-19
.
Changing comparator type is not allowed
6.
Although changing comparator type is not allowed, we can always
change the data type of the column and key validation class as fol-
lows:
update column family default with
key_validation_class=UTF8Type and
default_validation_class = UTF8Type;
Columns in a row are sorted by column names and that's where
comparator plays a vital role. Based on comparator type (i.e.,
UTF8Type
,
Int32Type
, etc.) columns can be stored in a sorted
manner.
CQL3 Way
Cassandra CQL3 is the driving factor at present. Most of the high-level APIs are sup-
porting and extending further development around it.
Let's discuss a few tricks while dealing with data types in CQL3 way. We will ex-
plore with the default column family created in the Thrift way (see the preceding sec-
tion).
1.
Select * from default;
Figure 2-20
.
Retrieving values using cql shell