Learning Apache Cassandra(Second Edition)
上QQ阅读APP看书,第一时间看更新

Integers

Cassandra has five types that store integers:

  • The int type stores 32-bit integers, which can store values ranging from approximately -2.1 billion to 2.1 billion
  • The bigint type stores 64-bit integers, which can store values from about -9 quintillion to 9 quintillion
  • The smallint type stores 16-bit integers, which can store values from -32,768 to 32,767
  • The tinyint type stores 8-bit integers, which can store values from -128 to 127
  • The varint type stores integers of arbitrary size; it has no minimum or maximum value

All integer types are signed, meaning they can hold positive or negative integers. There are no unsigned numeric types in Cassandra. Integer literals in CQL, like in most languages, consist of an optional minus sign followed by one or more digits, such as 3,549.