Data Types:

cql_type ::=native_type | collection_type | user_defined_type | tuple_type | custom_type

Native Types:


Cassandra CQL Data Types_sed


Counters:

counter type is used to define counter columns. 存储64-bit signed integer 并且支持两种操作 incrementing(增值) and decrementing(减值).

注意计数器的值不能被设置:当counter does not exist until first incremented / decremented,第一次increment / decrement 之前的值是0.

Counters 有几点重要限制:

PRIMARY KEY

2)主键的表的所有列为计数器类型,或者没有一个是计数器类型的.

3)Counters 不支持终止.

4)The delete of counters is supported, but is only guaranteed(担保) to work the first time you delete a counter . 换句话说,你不能重复修改 a counter that you have deleted(if you do , proper behavior is not guaranteed).

5)if a counter update fails unexpectedly(timeout or loss of connection) the client has no way to know if the update has been applied or not , In particular,replaying the update may or may not lead to an over count.

Working with timestamps:

Values of the timestamp type are encode as 64-bit signed integers representing a number of milliseconds since the standard base time known as :January 1 1970

Timestamps can be input in CQL either using their value as an integer ,or using a string that represents as ISO 8601 date. For instance ,all of the values below:

  • ​1299038700000​
  • ​'2011-02-0304:05+0000'​
  • ​'2011-02-0304:05:00+0000'​
  • ​'2011-02-0304:05:00.000+0000'​
  • ​'2011-02-03T04:05+0000'​
  • ​'2011-02-03T04:05:00+0000'​
  • ​'2011-02-03T04:05:00.000+0000'​


Working with dates:

​date​​type are encoded as 32-bit unsigned integers representing a number of days with “the epoch” atthe center of the range (2^31). Epoch is January 1st, 1970

timestamp, a date can be input either as an​​integer​​​ or using a date​​string​​​. In the later case, the format should be ​​yyyy-mm-dd​​​ (so​​'2011-02-03'​​ for instance).



Working with times:

​time​​type are encoded as 64-bit signed integers representing the number of nanoseconds since midnight.

timestamp, a time can be input either as an​​integer​​​ or using a​​string​​​representing the time. In the later case, the format should be​​hh:mm:ss[.fffffffff]​

  • ​'08:12:54'​
  • ​'08:12:54.123'​
  • ​'08:12:54.123456'​
  • ​'08:12:54.123456789'​


Collections:

CQL supports 3 kind of collections : Maps   Sets   Lists 

Maps:

A map