You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2015/07/09 18:56:54 UTC

svn commit: r1690127 - /cassandra/site/publish/doc/cql3/CQL-2.2.html

Author: tylerhobbs
Date: Thu Jul  9 16:56:54 2015
New Revision: 1690127

URL: http://svn.apache.org/r1690127
Log:
Update JSON docs for Cassandra 2.2

Modified:
    cassandra/site/publish/doc/cql3/CQL-2.2.html

Modified: cassandra/site/publish/doc/cql3/CQL-2.2.html
URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/cql3/CQL-2.2.html?rev=1690127&r1=1690126&r2=1690127&view=diff
==============================================================================
--- cassandra/site/publish/doc/cql3/CQL-2.2.html (original)
+++ cassandra/site/publish/doc/cql3/CQL-2.2.html Thu Jul  9 16:56:54 2015
@@ -1,4 +1,4 @@
-<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>CQL-2.2</title></head><body><p><link rel="StyleSheet" href="CQL.css" type="text/css" media="screen"></p><h1 id="CassandraQueryLanguageCQLv3.3.0">Cassandra Query Language (CQL) v3.3.0</h1><span id="tableOfContents"><ol style="list-style: none;"><li><a href="CQL-2.2.html#CassandraQueryLanguageCQLv3.3.0">Cassandra Query Language (CQL) v3.3.0</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#CQLSyntax">CQL Syntax</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#Preamble">Preamble</a></li><li><a href="CQL-2.2.html#Conventions">Conventions</a></li><li><a href="CQL-2.2.html#identifiers">Identifiers and keywords</a></li><li><a href="CQL-2.2.html#constants">Constants</a></li><li><a href="CQL-2.
 2.html#Comments">Comments</a></li><li><a href="CQL-2.2.html#statements">Statements</a></li><li><a href="CQL-2.2.html#preparedStatement">Prepared Statement</a></li></ol></li><li><a href="CQL-2.2.html#dataDefinition">Data Definition</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#createKeyspaceStmt">CREATE KEYSPACE</a></li><li><a href="CQL-2.2.html#useStmt">USE</a></li><li><a href="CQL-2.2.html#alterKeyspaceStmt">ALTER KEYSPACE</a></li><li><a href="CQL-2.2.html#dropKeyspaceStmt">DROP KEYSPACE</a></li><li><a href="CQL-2.2.html#createTableStmt">CREATE TABLE</a></li><li><a href="CQL-2.2.html#alterTableStmt">ALTER TABLE</a></li><li><a href="CQL-2.2.html#dropTableStmt">DROP TABLE</a></li><li><a href="CQL-2.2.html#truncateStmt">TRUNCATE</a></li><li><a href="CQL-2.2.html#createIndexStmt">CREATE INDEX</a></li><li><a href="CQL-2.2.html#dropIndexStmt">DROP INDEX</a></li><li><a href="CQL-2.2.html#createTypeStmt">CREATE TYPE</a></li><li><a href="CQL-2.2.html#alterTypeStmt">ALTER TYPE</
 a></li><li><a href="CQL-2.2.html#dropTypeStmt">DROP TYPE</a></li><li><a href="CQL-2.2.html#createTriggerStmt">CREATE TRIGGER</a></li><li><a href="CQL-2.2.html#dropTriggerStmt">DROP TRIGGER</a></li><li><a href="CQL-2.2.html#createFunctionStmt">CREATE FUNCTION</a></li><li><a href="CQL-2.2.html#dropFunctionStmt">DROP FUNCTION</a></li><li><a href="CQL-2.2.html#createAggregateStmt">CREATE AGGREGATE</a></li><li><a href="CQL-2.2.html#dropAggregateStmt">DROP AGGREGATE</a></li></ol></li><li><a href="CQL-2.2.html#dataManipulation">Data Manipulation</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#insertStmt">INSERT</a></li><li><a href="CQL-2.2.html#updateStmt">UPDATE</a></li><li><a href="CQL-2.2.html#deleteStmt">DELETE</a></li><li><a href="CQL-2.2.html#batchStmt">BATCH</a></li></ol></li><li><a href="CQL-2.2.html#queries">Queries</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#selectStmt">SELECT</a></li></ol></li><li><a href="CQL-2.2.html#databaseRoles">Database Roles</a><
 ol style="list-style: none;"><li><a href="CQL-2.2.html#createRoleStmt">CREATE ROLE</a></li><li><a href="CQL-2.2.html#alterRoleStmt">ALTER ROLE</a></li><li><a href="CQL-2.2.html#dropRoleStmt">DROP ROLE</a></li><li><a href="CQL-2.2.html#grantRoleStmt">GRANT ROLE</a></li><li><a href="CQL-2.2.html#revokeRoleStmt">REVOKE ROLE</a></li><li><a href="CQL-2.2.html#createUserStmt">CREATE USER </a></li><li><a href="CQL-2.2.html#alterUserStmt">ALTER USER </a></li><li><a href="CQL-2.2.html#dropUserStmt">DROP USER </a></li><li><a href="CQL-2.2.html#listUsersStmt">LIST USERS</a></li></ol></li><li><a href="CQL-2.2.html#dataControl">Data Control</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#permissions">Permissions </a></li><li><a href="CQL-2.2.html#grantPermissionsStmt">GRANT PERMISSION</a></li><li><a href="CQL-2.2.html#revokePermissionsStmt">REVOKE PERMISSION</a></li></ol></li><li><a href="CQL-2.2.html#types">Data Types</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#usingti
 mestamps">Working with timestamps</a></li><li><a href="CQL-2.2.html#usingdates">Working with dates</a></li><li><a href="CQL-2.2.html#usingtime">Working with time</a></li><li><a href="CQL-2.2.html#counters">Counters</a></li><li><a href="CQL-2.2.html#collections">Working with collections</a></li></ol></li><li><a href="CQL-2.2.html#functions">Functions</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#tokenFun">Token</a></li><li><a href="CQL-2.2.html#uuidFun">Uuid</a></li><li><a href="CQL-2.2.html#timeuuidFun">Timeuuid functions</a></li><li><a href="CQL-2.2.html#timeFun">Time conversion functions</a></li><li><a href="CQL-2.2.html#blobFun">Blob conversion functions</a></li></ol></li><li><a href="CQL-2.2.html#udfs">User-Defined Functions</a></li><li><a href="CQL-2.2.html#udas">User-Defined Aggregates</a></li><li><a href="CQL-2.2.html#json">JSON Support</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#selectJson">SELECT JSON</a></li><li><a href="CQL-2.2.html#insertJson"
 >INSERT JSON</a></li><li><a href="CQL-2.2.html#jsonEncoding">JSON Encoding of Cassandra Data Types</a></li><li><a href="CQL-2.2.html#fromJson">The fromJson() Function</a></li><li><a href="CQL-2.2.html#toJson">The toJson() Function</a></li></ol></li><li><a href="CQL-2.2.html#appendixA">Appendix A: CQL Keywords</a></li><li><a href="CQL-2.2.html#appendixB">Appendix B: CQL Reserved Types</a></li><li><a href="CQL-2.2.html#changes">Changes</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#a3.3.0">3.3.0</a></li><li><a href="CQL-2.2.html#a3.2.0">3.2.0</a></li><li><a href="CQL-2.2.html#a3.1.7">3.1.7</a></li><li><a href="CQL-2.2.html#a3.1.6">3.1.6</a></li><li><a href="CQL-2.2.html#a3.1.5">3.1.5</a></li><li><a href="CQL-2.2.html#a3.1.4">3.1.4</a></li><li><a href="CQL-2.2.html#a3.1.3">3.1.3</a></li><li><a href="CQL-2.2.html#a3.1.2">3.1.2</a></li><li><a href="CQL-2.2.html#a3.1.1">3.1.1</a></li><li><a href="CQL-2.2.html#a3.1.0">3.1.0</a></li><li><a href="CQL-2.2.html#a3.0.5">3.0.5</a></l
 i><li><a href="CQL-2.2.html#a3.0.4">3.0.4</a></li><li><a href="CQL-2.2.html#a3.0.3">3.0.3</a></li><li><a href="CQL-2.2.html#a3.0.2">3.0.2</a></li><li><a href="CQL-2.2.html#a3.0.1">3.0.1</a></li></ol></li><li><a href="CQL-2.2.html#Versioning">Versioning</a></li></ol></li></ol></span><h2 id="CQLSyntax">CQL Syntax</h2><h3 id="Preamble">Preamble</h3><p>This document describes the Cassandra Query Language (CQL) version 3. CQL v3 is not backward compatible with CQL v2 and differs from it in numerous ways. Note that this document describes the last version of the languages. However, the <a href="#changes">changes</a> section provides the diff between the different versions of CQL v3.</p><p>CQL v3 offers a model very close to SQL in the sense that data is put in <em>tables</em> containing <em>rows</em> of <em>columns</em>. For that reason, when used in this document, these terms (tables, rows and columns) have the same definition than they have in SQL. But please note that as such, they do 
 <strong>not</strong> refer to the concept of rows and columns found in the internal implementation of Cassandra and in the thrift and CQL v2 API.</p><h3 id="Conventions">Conventions</h3><p>To aid in specifying the CQL syntax, we will use the following conventions in this document:</p><ul><li>Language rules will be given in a <a href="http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form">BNF</a> -like notation:</li></ul><pre class="syntax"><pre>&lt;start> ::= TERMINAL &lt;non-terminal1> &lt;non-terminal1>
+<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>CQL-2.2</title></head><body><p><link rel="StyleSheet" href="CQL.css" type="text/css" media="screen"></p><h1 id="CassandraQueryLanguageCQLv3.3.0">Cassandra Query Language (CQL) v3.3.0</h1><span id="tableOfContents"><ol style="list-style: none;"><li><a href="CQL-2.2.html#CassandraQueryLanguageCQLv3.3.0">Cassandra Query Language (CQL) v3.3.0</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#CQLSyntax">CQL Syntax</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#Preamble">Preamble</a></li><li><a href="CQL-2.2.html#Conventions">Conventions</a></li><li><a href="CQL-2.2.html#identifiers">Identifiers and keywords</a></li><li><a href="CQL-2.2.html#constants">Constants</a></li><li><a href="CQL-2.
 2.html#Comments">Comments</a></li><li><a href="CQL-2.2.html#statements">Statements</a></li><li><a href="CQL-2.2.html#preparedStatement">Prepared Statement</a></li></ol></li><li><a href="CQL-2.2.html#dataDefinition">Data Definition</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#createKeyspaceStmt">CREATE KEYSPACE</a></li><li><a href="CQL-2.2.html#useStmt">USE</a></li><li><a href="CQL-2.2.html#alterKeyspaceStmt">ALTER KEYSPACE</a></li><li><a href="CQL-2.2.html#dropKeyspaceStmt">DROP KEYSPACE</a></li><li><a href="CQL-2.2.html#createTableStmt">CREATE TABLE</a></li><li><a href="CQL-2.2.html#alterTableStmt">ALTER TABLE</a></li><li><a href="CQL-2.2.html#dropTableStmt">DROP TABLE</a></li><li><a href="CQL-2.2.html#truncateStmt">TRUNCATE</a></li><li><a href="CQL-2.2.html#createIndexStmt">CREATE INDEX</a></li><li><a href="CQL-2.2.html#dropIndexStmt">DROP INDEX</a></li><li><a href="CQL-2.2.html#createTypeStmt">CREATE TYPE</a></li><li><a href="CQL-2.2.html#alterTypeStmt">ALTER TYPE</
 a></li><li><a href="CQL-2.2.html#dropTypeStmt">DROP TYPE</a></li><li><a href="CQL-2.2.html#createTriggerStmt">CREATE TRIGGER</a></li><li><a href="CQL-2.2.html#dropTriggerStmt">DROP TRIGGER</a></li><li><a href="CQL-2.2.html#createFunctionStmt">CREATE FUNCTION</a></li><li><a href="CQL-2.2.html#dropFunctionStmt">DROP FUNCTION</a></li><li><a href="CQL-2.2.html#createAggregateStmt">CREATE AGGREGATE</a></li><li><a href="CQL-2.2.html#dropAggregateStmt">DROP AGGREGATE</a></li></ol></li><li><a href="CQL-2.2.html#dataManipulation">Data Manipulation</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#insertStmt">INSERT</a></li><li><a href="CQL-2.2.html#updateStmt">UPDATE</a></li><li><a href="CQL-2.2.html#deleteStmt">DELETE</a></li><li><a href="CQL-2.2.html#batchStmt">BATCH</a></li></ol></li><li><a href="CQL-2.2.html#queries">Queries</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#selectStmt">SELECT</a></li></ol></li><li><a href="CQL-2.2.html#databaseRoles">Database Roles</a><
 ol style="list-style: none;"><li><a href="CQL-2.2.html#createRoleStmt">CREATE ROLE</a></li><li><a href="CQL-2.2.html#alterRoleStmt">ALTER ROLE</a></li><li><a href="CQL-2.2.html#dropRoleStmt">DROP ROLE</a></li><li><a href="CQL-2.2.html#grantRoleStmt">GRANT ROLE</a></li><li><a href="CQL-2.2.html#revokeRoleStmt">REVOKE ROLE</a></li><li><a href="CQL-2.2.html#createUserStmt">CREATE USER </a></li><li><a href="CQL-2.2.html#alterUserStmt">ALTER USER </a></li><li><a href="CQL-2.2.html#dropUserStmt">DROP USER </a></li><li><a href="CQL-2.2.html#listUsersStmt">LIST USERS</a></li></ol></li><li><a href="CQL-2.2.html#dataControl">Data Control</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#permissions">Permissions </a></li><li><a href="CQL-2.2.html#grantPermissionsStmt">GRANT PERMISSION</a></li><li><a href="CQL-2.2.html#revokePermissionsStmt">REVOKE PERMISSION</a></li></ol></li><li><a href="CQL-2.2.html#types">Data Types</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#usingti
 mestamps">Working with timestamps</a></li><li><a href="CQL-2.2.html#usingdates">Working with dates</a></li><li><a href="CQL-2.2.html#usingtime">Working with time</a></li><li><a href="CQL-2.2.html#counters">Counters</a></li><li><a href="CQL-2.2.html#collections">Working with collections</a></li></ol></li><li><a href="CQL-2.2.html#functions">Functions</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#tokenFun">Token</a></li><li><a href="CQL-2.2.html#uuidFun">Uuid</a></li><li><a href="CQL-2.2.html#timeuuidFun">Timeuuid functions</a></li><li><a href="CQL-2.2.html#timeFun">Time conversion functions</a></li><li><a href="CQL-2.2.html#blobFun">Blob conversion functions</a></li></ol></li><li><a href="CQL-2.2.html#aggregates">Aggregates</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#countFct">Count</a></li><li><a href="CQL-2.2.html#maxMinFcts">Max and Min</a></li><li><a href="CQL-2.2.html#sumFct">Sum</a></li><li><a href="CQL-2.2.html#avgFct">Avg</a></li></ol></li><li><a h
 ref="CQL-2.2.html#udfs">User-Defined Functions</a></li><li><a href="CQL-2.2.html#udas">User-Defined Aggregates</a></li><li><a href="CQL-2.2.html#json">JSON Support</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#selectJson">SELECT JSON</a></li><li><a href="CQL-2.2.html#insertJson">INSERT JSON</a></li><li><a href="CQL-2.2.html#jsonEncoding">JSON Encoding of Cassandra Data Types</a></li><li><a href="CQL-2.2.html#fromJson">The fromJson() Function</a></li><li><a href="CQL-2.2.html#toJson">The toJson() Function</a></li></ol></li><li><a href="CQL-2.2.html#appendixA">Appendix A: CQL Keywords</a></li><li><a href="CQL-2.2.html#appendixB">Appendix B: CQL Reserved Types</a></li><li><a href="CQL-2.2.html#changes">Changes</a><ol style="list-style: none;"><li><a href="CQL-2.2.html#a3.3.0">3.3.0</a></li><li><a href="CQL-2.2.html#a3.2.0">3.2.0</a></li><li><a href="CQL-2.2.html#a3.1.7">3.1.7</a></li><li><a href="CQL-2.2.html#a3.1.6">3.1.6</a></li><li><a href="CQL-2.2.html#a3.1.5">3.1.5</a
 ></li><li><a href="CQL-2.2.html#a3.1.4">3.1.4</a></li><li><a href="CQL-2.2.html#a3.1.3">3.1.3</a></li><li><a href="CQL-2.2.html#a3.1.2">3.1.2</a></li><li><a href="CQL-2.2.html#a3.1.1">3.1.1</a></li><li><a href="CQL-2.2.html#a3.1.0">3.1.0</a></li><li><a href="CQL-2.2.html#a3.0.5">3.0.5</a></li><li><a href="CQL-2.2.html#a3.0.4">3.0.4</a></li><li><a href="CQL-2.2.html#a3.0.3">3.0.3</a></li><li><a href="CQL-2.2.html#a3.0.2">3.0.2</a></li><li><a href="CQL-2.2.html#a3.0.1">3.0.1</a></li></ol></li><li><a href="CQL-2.2.html#Versioning">Versioning</a></li></ol></li></ol></span><h2 id="CQLSyntax">CQL Syntax</h2><h3 id="Preamble">Preamble</h3><p>This document describes the Cassandra Query Language (CQL) version 3. CQL v3 is not backward compatible with CQL v2 and differs from it in numerous ways. Note that this document describes the last version of the languages. However, the <a href="#changes">changes</a> section provides the diff between the different versions of CQL v3.</p><p>CQL v3 offers
  a model very close to SQL in the sense that data is put in <em>tables</em> containing <em>rows</em> of <em>columns</em>. For that reason, when used in this document, these terms (tables, rows and columns) have the same definition than they have in SQL. But please note that as such, they do <strong>not</strong> refer to the concept of rows and columns found in the internal implementation of Cassandra and in the thrift and CQL v2 API.</p><h3 id="Conventions">Conventions</h3><p>To aid in specifying the CQL syntax, we will use the following conventions in this document:</p><ul><li>Language rules will be given in a <a href="http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form">BNF</a> -like notation:</li></ul><pre class="syntax"><pre>&lt;start> ::= TERMINAL &lt;non-terminal1> &lt;non-terminal1>
 </pre></pre><ul><li>Nonterminal symbols will have <code>&lt;angle brackets></code>.</li><li>As additional shortcut notations to BNF, we&#8217;ll use traditional regular expression&#8217;s symbols (<code>?</code>, <code>+</code> and <code>*</code>) to signify that a given symbol is optional and/or can be repeated. We&#8217;ll also allow parentheses to group symbols and the <code>[&lt;characters>]</code> notation to represent any one of <code>&lt;characters></code>.</li><li>The grammar is provided for documentation purposes and leave some minor details out. For instance, the last column definition in a <code>CREATE TABLE</code> statement is optional but supported if present even though the provided grammar in this document suggest it is not supported. </li><li>Sample code will be provided in a code block:</li></ul><pre class="sample"><pre>SELECT sample_usage FROM cql;
 </pre></pre><ul><li>References to keywords or pieces of CQL code in running text will be shown in a <code>fixed-width font</code>.</li></ul><h3 id="identifiers">Identifiers and keywords</h3><p>The CQL language uses <em>identifiers</em> (or <em>names</em>) to identify tables, columns and other objects. An identifier is a token matching the regular expression <code>[a-zA-Z]</code><code>[a-zA-Z0-9_]</code><code>*</code>.</p><p>A number of such identifiers, like <code>SELECT</code> or <code>WITH</code>, are <em>keywords</em>. They have a fixed meaning for the language and most are reserved. The list of those keywords can be found in <a href="#appendixA">Appendix A</a>.</p><p>Identifiers and (unquoted) keywords are case insensitive. Thus <code>SELECT</code> is the same than <code>select</code> or <code>sElEcT</code>, and <code>myId</code> is the same than <code>myid</code> or <code>MYID</code> for instance. A convention often used (in particular by the samples of this documentation) is t
 o use upper case for keywords and lower case for other identifiers.</p><p>There is a second kind of identifiers called <em>quoted identifiers</em> defined by enclosing an arbitrary sequence of characters in double-quotes(<code>"</code>). Quoted identifiers are never keywords. Thus <code>"select"</code> is not a reserved keyword and can be used to refer to a column, while <code>select</code> would raise a parse error. Also, contrarily to unquoted identifiers and keywords, quoted identifiers are case sensitive (<code>"My Quoted Id"</code> is <em>different</em> from <code>"my quoted id"</code>). A fully lowercase quoted identifier that matches <code>[a-zA-Z]</code><code>[a-zA-Z0-9_]</code><code>*</code> is equivalent to the unquoted identifier obtained by removing the double-quote (so <code>"myid"</code> is equivalent to <code>myid</code> and to <code>myId</code> but different from <code>"myId"</code>). Inside a quoted identifier, the double-quote character can be repeated to escape it
 , so <code>"foo "" bar"</code> is a valid identifier.</p><h3 id="constants">Constants</h3><p>CQL defines the following kind of <em>constants</em>: strings, integers, floats, booleans, uuids and blobs:</p><ul><li>A string constant is an arbitrary sequence of characters characters enclosed by single-quote(<code>'</code>). One can include a single-quote in a string by repeating it, e.g. <code>'It''s raining today'</code>. Those are not to be confused with quoted identifiers that use double-quotes.</li><li>An integer constant is defined by <code>'-'?[0-9]+</code>.</li><li>A float constant is defined by <code>'-'?[0-9]+('.'[0-9]*)?([eE][+-]?[0-9+])?</code>. On top of that, <code>NaN</code> and <code>Infinity</code> are also float constants.</li><li>A boolean constant is either <code>true</code> or <code>false</code> up to case-insensitivity (i.e. <code>True</code> is a valid boolean constant).</li><li>A <a href="http://en.wikipedia.org/wiki/Universally_unique_identifier">UUID</a> constan
 t is defined by <code>hex{8}-hex{4}-hex{4}-hex{4}-hex{12}</code> where <code>hex</code> is an hexadecimal character, e.g. <code>[0-9a-fA-F]</code> and <code>{4}</code> is the number of such characters.</li><li>A blob constant is an hexadecimal number defined by <code>0[xX](hex)+</code> where <code>hex</code> is an hexadecimal character, e.g. <code>[0-9a-fA-F]</code>.</li></ul><p>For how these constants are typed, see the <a href="#types">data types section</a>.</p><h3 id="Comments">Comments</h3><p>A comment in CQL is a line beginning by either double dashes (<code>--</code>) or double slash (<code>//</code>).</p><p>Multi-line comments are also supported through enclosure within <code>/*</code> and <code>*/</code> (but nesting is not supported).</p><pre class="sample"><pre>-- This is a comment
 // This is a comment too
@@ -104,7 +104,7 @@ CREATE TABLE timeline (
 INSERT INTO test(pk, t, v, s) VALUES (0, 0, 'val0', 'static0');
 INSERT INTO test(pk, t, v, s) VALUES (0, 1, 'val1', 'static1');
 SELECT * FROM test WHERE pk=0 AND t=0;
-</pre></pre><p>the last query will return <code>'static1'</code> as value for <code>s</code>, since <code>s</code> is static and thus the 2nd insertion modified this &#8220;shared&#8221; value. Note however that static columns are only static within a given partition, and if in the example above both rows where from different partitions (i.e. if they had different value for <code>pk</code>), then the 2nd insertion would not have modified the value of <code>s</code> for the first row.</p><p>A few restrictions applies to when static columns are allowed:</p><ul><li>tables with the <code>COMPACT STORAGE</code> option (see below) cannot have them</li><li>a table without clustering columns cannot have static columns (in a table without clustering columns, every partition has only one row, and so every column is inherently static).</li><li>only non <code>PRIMARY KEY</code> columns can be static</li></ul><h4 id="createTableOptions"><code>&lt;option></code></h4><p>The <code>CREATE TABLE</cod
 e> statement supports a number of options that controls the configuration of a new table. These options can be specified after the <code>WITH</code> keyword.</p><p>The first of these option is <code>COMPACT STORAGE</code>. This option is mainly targeted towards backward compatibility for definitions created before CQL3 (see <a href="http://www.datastax.com/dev/blog/thrift-to-cql3">www.datastax.com/dev/blog/thrift-to-cql3</a> for more details).  The option also provides a slightly more compact layout of data on disk but at the price of diminished flexibility and extensibility for the table.  Most notably, <code>COMPACT STORAGE</code> tables cannot have collections nor static columns and a <code>COMPACT STORAGE</code> table with at least one clustering column supports exactly one (as in not 0 nor more than 1) column not part of the <code>PRIMARY KEY</code> definition (which imply in particular that you cannot add nor remove columns after creation). For those reasons, <code>COMPACT STO
 RAGE</code> is not recommended outside of the backward compatibility reason evoked above.</p><p>Another option is <code>CLUSTERING ORDER</code>. It allows to define the ordering of rows on disk. It takes the list of the clustering column names with, for each of them, the on-disk order (Ascending or descending). Note that this option affects <a href="#selectOrderBy">what <code>ORDER BY</code> are allowed during <code>SELECT</code></a>.</p><p>Table creation supports the following other <code>&lt;property></code>:</p><table><tr><th>option                    </th><th>kind   </th><th>default   </th><th>description</th></tr><tr><td><code>comment</code>                    </td><td><em>simple</em> </td><td>none        </td><td>A free-form, human-readable comment.</td></tr><tr><td><code>read_repair_chance</code>         </td><td><em>simple</em> </td><td>0.1         </td><td>The probability with which to query extra nodes (e.g. more nodes than required by the consistency level) for the purpos
 e of read repairs.</td></tr><tr><td><code>dclocal_read_repair_chance</code> </td><td><em>simple</em> </td><td>0           </td><td>The probability with which to query extra nodes (e.g. more nodes than required by the consistency level) belonging to the same data center than the read coordinator for the purpose of read repairs.</td></tr><tr><td><code>gc_grace_seconds</code>           </td><td><em>simple</em> </td><td>864000      </td><td>Time to wait before garbage collecting tombstones (deletion markers).</td></tr><tr><td><code>bloom_filter_fp_chance</code>     </td><td><em>simple</em> </td><td>0.00075     </td><td>The target probability of false positive of the sstable bloom filters. Said bloom filters will be sized to provide the provided probability (thus lowering this value impact the size of bloom filters in-memory and on-disk)</td></tr><tr><td><code>compaction</code>                 </td><td><em>map</em>    </td><td><em>see below</em> </td><td>The compaction options to use, se
 e below.</td></tr><tr><td><code>compression</code>                </td><td><em>map</em>    </td><td><em>see below</em> </td><td>Compression options, see below. </td></tr><tr><td><code>caching</code>                    </td><td><em>simple</em> </td><td>keys_only   </td><td>Whether to cache keys (&#8220;key cache&#8221;) and/or rows (&#8220;row cache&#8221;) for this table. Valid values are: <code>all</code>, <code>keys_only</code>, <code>rows_only</code> and <code>none</code>. </td></tr><tr><td><code>default_time_to_live</code>       </td><td><em>simple</em> </td><td>0           </td><td>The default expiration time (&#8220;TTL&#8221;) in seconds for a table.</td></tr></table><h4 id="compactionOptions"><code>compaction</code> options</h4><p>The <code>compaction</code> property must at least define the <code>'class'</code> sub-option, that defines the compaction strategy class to use. The default supported class are <code>'SizeTieredCompactionStrategy'</code> and <code>'LeveledCompacti
 onStrategy'</code>. Custom strategy can be provided by specifying the full class name as a <a href="#constants">string constant</a>. The rest of the sub-options depends on the chosen class. The sub-options supported by the default classes are:</p><table><tr><th>option                         </th><th>supported compaction strategy </th><th>default </th><th>description </th></tr><tr><td><code>enabled</code>                        </td><td><em>all</em>                           </td><td>true      </td><td>A boolean denoting whether compaction should be enabled or not.</td></tr><tr><td><code>tombstone_threshold</code>            </td><td><em>all</em>                           </td><td>0.2       </td><td>A ratio such that if a sstable has more than this ratio of gcable tombstones over all contained columns, the sstable will be compacted (with no other sstables) for the purpose of purging those tombstones. </td></tr><tr><td><code>tombstone_compaction_interval</code>  </td><td><em>all</em>
                            </td><td>1 day     </td><td>The minimum time to wait after an sstable creation time before considering it for &#8220;tombstone compaction&#8221;, where &#8220;tombstone compaction&#8221; is the compaction triggered if the sstable has more gcable tombstones than <code>tombstone_threshold</code>. </td></tr><tr><td><code>unchecked_tombstone_compaction</code> </td><td><em>all</em>                           </td><td>false    </td><td>Setting this to true enables more aggressive tombstone compactions &#8211; single sstable tombstone compactions will run without checking how likely it is that they will be successful. </td></tr><tr><td><code>min_sstable_size</code>               </td><td>SizeTieredCompactionStrategy    </td><td>50MB      </td><td>The size tiered strategy groups SSTables to compact in buckets. A bucket groups SSTables that differs from less than 50% in size.  However, for small sizes, this would result in a bucketing that is too fine grained. <code
 >min_sstable_size</code> defines a size threshold (in bytes) below which all SSTables belong to one unique bucket</td></tr><tr><td><code>min_threshold</code>                  </td><td>SizeTieredCompactionStrategy    </td><td>4         </td><td>Minimum number of SSTables needed to start a minor compaction.</td></tr><tr><td><code>max_threshold</code>                  </td><td>SizeTieredCompactionStrategy    </td><td>32        </td><td>Maximum number of SSTables processed by one minor compaction.</td></tr><tr><td><code>bucket_low</code>                     </td><td>SizeTieredCompactionStrategy    </td><td>0.5       </td><td>Size tiered consider sstables to be within the same bucket if their size is within [average_size * <code>bucket_low</code>, average_size * <code>bucket_high</code> ] (i.e the default groups sstable whose sizes diverges by at most 50%)</td></tr><tr><td><code>bucket_high</code>                    </td><td>SizeTieredCompactionStrategy    </td><td>1.5       </td><td>Siz
 e tiered consider sstables to be within the same bucket if their size is within [average_size * <code>bucket_low</code>, average_size * <code>bucket_high</code> ] (i.e the default groups sstable whose sizes diverges by at most 50%).</td></tr><tr><td><code>sstable_size_in_mb</code>             </td><td>LeveledCompactionStrategy       </td><td>5MB       </td><td>The target size (in MB) for sstables in the leveled strategy. Note that while sstable sizes should stay less or equal to <code>sstable_size_in_mb</code>, it is possible to exceptionally have a larger sstable as during compaction, data for a given partition key are never split into 2 sstables</td></tr></table><p>For the <code>compression</code> property, the following default sub-options are available:</p><table><tr><th>option              </th><th>default        </th><th>description </th></tr><tr><td><code>sstable_compression</code> </td><td>LZ4Compressor    </td><td>The compression algorithm to use. Default compressor are: LZ
 4Compressor, SnappyCompressor and DeflateCompressor. Use an empty string (<code>''</code>) to disable compression. Custom compressor can be provided by specifying the full class name as a <a href="#constants">string constant</a>.</td></tr><tr><td><code>chunk_length_kb</code>     </td><td>64KB             </td><td>On disk SSTables are compressed by block (to allow random reads). This defines the size (in KB) of said block. Bigger values may improve the compression rate, but increases the minimum size of data to be read from disk for a read </td></tr><tr><td><code>crc_check_chance</code>    </td><td>1.0              </td><td>When compression is enabled, each compressed block includes a checksum of that block for the purpose of detecting disk bitrot and avoiding the propagation of corruption to other replica. This option defines the probability with which those checksums are checked during read. By default they are always checked. Set to 0 to disable checksum checking and to 0.5 for in
 stance to check them every other read</td></tr></table><h4 id="Otherconsiderations">Other considerations:</h4><ul><li>When <a href="#insertStmt/&quot;updating&quot;:#updateStmt">inserting</a> a given row, not all columns needs to be defined (except for those part of the key), and missing columns occupy no space on disk. Furthermore, adding new columns (see &lt;a href=#alterStmt><tt>ALTER TABLE</tt></a>) is a constant time operation. There is thus no need to try to anticipate future usage (or to cry when you haven&#8217;t) when creating a table.</li></ul><h3 id="alterTableStmt">ALTER TABLE</h3><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;alter-table-stmt> ::= ALTER (TABLE | COLUMNFAMILY) &lt;tablename> &lt;instruction>
+</pre></pre><p>the last query will return <code>'static1'</code> as value for <code>s</code>, since <code>s</code> is static and thus the 2nd insertion modified this &#8220;shared&#8221; value. Note however that static columns are only static within a given partition, and if in the example above both rows where from different partitions (i.e. if they had different value for <code>pk</code>), then the 2nd insertion would not have modified the value of <code>s</code> for the first row.</p><p>A few restrictions applies to when static columns are allowed:</p><ul><li>tables with the <code>COMPACT STORAGE</code> option (see below) cannot have them</li><li>a table without clustering columns cannot have static columns (in a table without clustering columns, every partition has only one row, and so every column is inherently static).</li><li>only non <code>PRIMARY KEY</code> columns can be static</li></ul><h4 id="createTableOptions"><code>&lt;option></code></h4><p>The <code>CREATE TABLE</cod
 e> statement supports a number of options that controls the configuration of a new table. These options can be specified after the <code>WITH</code> keyword.</p><p>The first of these option is <code>COMPACT STORAGE</code>. This option is mainly targeted towards backward compatibility for definitions created before CQL3 (see <a href="http://www.datastax.com/dev/blog/thrift-to-cql3">www.datastax.com/dev/blog/thrift-to-cql3</a> for more details).  The option also provides a slightly more compact layout of data on disk but at the price of diminished flexibility and extensibility for the table.  Most notably, <code>COMPACT STORAGE</code> tables cannot have collections nor static columns and a <code>COMPACT STORAGE</code> table with at least one clustering column supports exactly one (as in not 0 nor more than 1) column not part of the <code>PRIMARY KEY</code> definition (which imply in particular that you cannot add nor remove columns after creation). For those reasons, <code>COMPACT STO
 RAGE</code> is not recommended outside of the backward compatibility reason evoked above.</p><p>Another option is <code>CLUSTERING ORDER</code>. It allows to define the ordering of rows on disk. It takes the list of the clustering column names with, for each of them, the on-disk order (Ascending or descending). Note that this option affects <a href="#selectOrderBy">what <code>ORDER BY</code> are allowed during <code>SELECT</code></a>.</p><p>Table creation supports the following other <code>&lt;property></code>:</p><table><tr><th>option                    </th><th>kind   </th><th>default   </th><th>description</th></tr><tr><td><code>comment</code>                    </td><td><em>simple</em> </td><td>none        </td><td>A free-form, human-readable comment.</td></tr><tr><td><code>read_repair_chance</code>         </td><td><em>simple</em> </td><td>0.1         </td><td>The probability with which to query extra nodes (e.g. more nodes than required by the consistency level) for the purpos
 e of read repairs.</td></tr><tr><td><code>dclocal_read_repair_chance</code> </td><td><em>simple</em> </td><td>0           </td><td>The probability with which to query extra nodes (e.g. more nodes than required by the consistency level) belonging to the same data center than the read coordinator for the purpose of read repairs.</td></tr><tr><td><code>gc_grace_seconds</code>           </td><td><em>simple</em> </td><td>864000      </td><td>Time to wait before garbage collecting tombstones (deletion markers).</td></tr><tr><td><code>bloom_filter_fp_chance</code>     </td><td><em>simple</em> </td><td>0.00075     </td><td>The target probability of false positive of the sstable bloom filters. Said bloom filters will be sized to provide the provided probability (thus lowering this value impact the size of bloom filters in-memory and on-disk)</td></tr><tr><td><code>compaction</code>                 </td><td><em>map</em>    </td><td><em>see below</em> </td><td>The compaction options to use, se
 e below.</td></tr><tr><td><code>compression</code>                </td><td><em>map</em>    </td><td><em>see below</em> </td><td>Compression options, see below. </td></tr><tr><td><code>caching</code>                    </td><td><em>simple</em> </td><td>keys_only   </td><td>Whether to cache keys (&#8220;key cache&#8221;) and/or rows (&#8220;row cache&#8221;) for this table. Valid values are: <code>all</code>, <code>keys_only</code>, <code>rows_only</code> and <code>none</code>. </td></tr><tr><td><code>default_time_to_live</code>       </td><td><em>simple</em> </td><td>0           </td><td>The default expiration time (&#8220;TTL&#8221;) in seconds for a table.</td></tr></table><h4 id="compactionOptions"><code>compaction</code> options</h4><p>The <code>compaction</code> property must at least define the <code>'class'</code> sub-option, that defines the compaction strategy class to use. The default supported class are <code>'SizeTieredCompactionStrategy'</code> and <code>'LeveledCompacti
 onStrategy'</code>. Custom strategy can be provided by specifying the full class name as a <a href="#constants">string constant</a>. The rest of the sub-options depends on the chosen class. The sub-options supported by the default classes are:</p><table><tr><th>option                         </th><th>supported compaction strategy </th><th>default </th><th>description </th></tr><tr><td><code>enabled</code>                        </td><td><em>all</em>                           </td><td>true      </td><td>A boolean denoting whether compaction should be enabled or not.</td></tr><tr><td><code>tombstone_threshold</code>            </td><td><em>all</em>                           </td><td>0.2       </td><td>A ratio such that if a sstable has more than this ratio of gcable tombstones over all contained columns, the sstable will be compacted (with no other sstables) for the purpose of purging those tombstones. </td></tr><tr><td><code>tombstone_compaction_interval</code>  </td><td><em>all</em>
                            </td><td>1 day     </td><td>The minimum time to wait after an sstable creation time before considering it for &#8220;tombstone compaction&#8221;, where &#8220;tombstone compaction&#8221; is the compaction triggered if the sstable has more gcable tombstones than <code>tombstone_threshold</code>. </td></tr><tr><td><code>unchecked_tombstone_compaction</code> </td><td><em>all</em>                           </td><td>false    </td><td>Setting this to true enables more aggressive tombstone compactions &#8211; single sstable tombstone compactions will run without checking how likely it is that they will be successful. </td></tr><tr><td><code>min_sstable_size</code>               </td><td>SizeTieredCompactionStrategy    </td><td>50MB      </td><td>The size tiered strategy groups SSTables to compact in buckets. A bucket groups SSTables that differs from less than 50% in size.  However, for small sizes, this would result in a bucketing that is too fine grained. <code
 >min_sstable_size</code> defines a size threshold (in bytes) below which all SSTables belong to one unique bucket</td></tr><tr><td><code>min_threshold</code>                  </td><td>SizeTieredCompactionStrategy    </td><td>4         </td><td>Minimum number of SSTables needed to start a minor compaction.</td></tr><tr><td><code>max_threshold</code>                  </td><td>SizeTieredCompactionStrategy    </td><td>32        </td><td>Maximum number of SSTables processed by one minor compaction.</td></tr><tr><td><code>bucket_low</code>                     </td><td>SizeTieredCompactionStrategy    </td><td>0.5       </td><td>Size tiered consider sstables to be within the same bucket if their size is within [average_size * <code>bucket_low</code>, average_size * <code>bucket_high</code> ] (i.e the default groups sstable whose sizes diverges by at most 50%)</td></tr><tr><td><code>bucket_high</code>                    </td><td>SizeTieredCompactionStrategy    </td><td>1.5       </td><td>Siz
 e tiered consider sstables to be within the same bucket if their size is within [average_size * <code>bucket_low</code>, average_size * <code>bucket_high</code> ] (i.e the default groups sstable whose sizes diverges by at most 50%).</td></tr><tr><td><code>sstable_size_in_mb</code>             </td><td>LeveledCompactionStrategy       </td><td>5MB       </td><td>The target size (in MB) for sstables in the leveled strategy. Note that while sstable sizes should stay less or equal to <code>sstable_size_in_mb</code>, it is possible to exceptionally have a larger sstable as during compaction, data for a given partition key are never split into 2 sstables</td></tr></table><p>For the <code>compression</code> property, the following default sub-options are available:</p><table><tr><th>option              </th><th>default        </th><th>description </th></tr><tr><td><code>sstable_compression</code> </td><td>LZ4Compressor    </td><td>The compression algorithm to use. Default compressor are: LZ
 4Compressor, SnappyCompressor and DeflateCompressor. Use an empty string (<code>''</code>) to disable compression. Custom compressor can be provided by specifying the full class name as a <a href="#constants">string constant</a>.</td></tr><tr><td><code>chunk_length_kb</code>     </td><td>64KB             </td><td>On disk SSTables are compressed by block (to allow random reads). This defines the size (in KB) of said block. Bigger values may improve the compression rate, but increases the minimum size of data to be read from disk for a read </td></tr><tr><td><code>crc_check_chance</code>    </td><td>1.0              </td><td>When compression is enabled, each compressed block includes a checksum of that block for the purpose of detecting disk bitrot and avoiding the propagation of corruption to other replica. This option defines the probability with which those checksums are checked during read. By default they are always checked. Set to 0 to disable checksum checking and to 0.5 for in
 stance to check them every other read</td></tr></table><h4 id="Otherconsiderations">Other considerations:</h4><ul><li>When <a href="#insertStmt">inserting</a> / <a href="#updateStmt">updating</a> a given row, not all columns needs to be defined (except for those part of the key), and missing columns occupy no space on disk. Furthermore, adding new columns (see &lt;a href=#alterStmt><tt>ALTER TABLE</tt></a>) is a constant time operation. There is thus no need to try to anticipate future usage (or to cry when you haven&#8217;t) when creating a table.</li></ul><h3 id="alterTableStmt">ALTER TABLE</h3><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;alter-table-stmt> ::= ALTER (TABLE | COLUMNFAMILY) &lt;tablename> &lt;instruction>
 
 &lt;instruction> ::= ALTER &lt;identifier> TYPE &lt;type>
                 | ADD   &lt;identifier> &lt;type>
@@ -208,7 +208,7 @@ CREATE FUNCTION akeyspace.fname IF NOT E
 DROP FUNCTION mykeyspace.afunction;
 DROP FUNCTION afunction ( int );
 DROP FUNCTION afunction ( text );
-</pre></pre><p><code>DROP FUNCTION</code> statement removes a function created using <code>CREATE FUNCTION</code>.<br/>You must specify the argument types (<a href="#functionSignature">signature</a>) of the function to drop if there are multiple functions with the same name but a different signature (overloaded functions).</p><p><code>DROP FUNCTION</code> with the optional <code>IF EXISTS</code> keywords drops a function if it exists.</p><h3 id="createAggregateStmt">CREATE AGGREGATE</h3><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;create-aggregate-stmt> ::= CREATE ( OR REPLACE )? 
+</pre></pre><p><code>DROP FUNCTION</code> statement removes a function created using <code>CREATE FUNCTION</code>.<br/>You must specify the argument types (<a href="#functionSignature">signature</a> ) of the function to drop if there are multiple functions with the same name but a different signature (overloaded functions).</p><p><code>DROP FUNCTION</code> with the optional <code>IF EXISTS</code> keywords drops a function if it exists.</p><h3 id="createAggregateStmt">CREATE AGGREGATE</h3><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;create-aggregate-stmt> ::= CREATE ( OR REPLACE )? 
                             AGGREGATE ( IF NOT EXISTS )?
                             ( &lt;keyspace> '.' )? &lt;aggregate-name>
                             '(' &lt;arg-type> ( ',' &lt;arg-type> )* ')'
@@ -374,7 +374,7 @@ SELECT entry_title, content FROM posts W
 </pre></pre><p>Moreover, the <code>IN</code> relation is only allowed on the last column of the partition key and on the last column of the full primary key.</p><p>It is also possible to &#8220;group&#8221; <code>CLUSTERING COLUMNS</code> together in a relation using the tuple notation. For instance:</p><pre class="sample"><pre>SELECT * FROM posts WHERE userid='john doe' AND (blog_title, posted_at) > ('John''s Blog', '2012-01-01')
 </pre></pre><p>will request all rows that sorts after the one having &#8220;John's Blog&#8221; as <code>blog_tile</code> and &#8216;2012-01-01&#8217; for <code>posted_at</code> in the clustering order. In particular, rows having a <code>post_at &lt;= '2012-01-01'</code> will be returned as long as their <code>blog_title > 'John''s Blog'</code>, which wouldn&#8217;t be the case for:</p><pre class="sample"><pre>SELECT * FROM posts WHERE userid='john doe' AND blog_title > 'John''s Blog' AND posted_at > '2012-01-01'
 </pre></pre><p>The tuple notation may also be used for <code>IN</code> clauses on <code>CLUSTERING COLUMNS</code>:</p><pre class="sample"><pre>SELECT * FROM posts WHERE userid='john doe' AND (blog_title, posted_at) IN (('John''s Blog', '2012-01-01), ('Extreme Chess', '2014-06-01'))
-</pre></pre><p>The <code>CONTAINS</code> operator may only be used on collection columns (lists, sets, and maps).  In the case of maps, <code>CONTAINS</code> applies to the map values. The <code>CONTAINS KEY</code> operator may only be used on map columns and applies to the map keys.</p><h4 id="selectOrderBy"><code>&lt;order-by></code></h4><p>The <code>ORDER BY</code> option allows to select the order of the returned results. It takes as argument a list of column names along with the order for the column (<code>ASC</code> for ascendant and <code>DESC</code> for descendant, omitting the order being equivalent to <code>ASC</code>). Currently the possible orderings are limited (which depends on the table <a href="#createTableOptions"><code>CLUSTERING ORDER</code></a>):</p><ul><li>if the table has been defined without any specific <code>CLUSTERING ORDER</code>, then then allowed orderings are the order induced by the clustering columns and the reverse of that one.</li><li>otherwise, the
  orderings allowed are the order of the <code>CLUSTERING ORDER</code> option and the reversed one.</li></ul><h4 id="selectLimit"><code>LIMIT</code></h4><p>The <code>LIMIT</code> option to a <code>SELECT</code> statement limits the number of rows returned by a query.</p><h4 id="selectAllowFiltering"><code>ALLOW FILTERING</code></h4><p>By default, CQL only allows select queries that don&#8217;t involve &#8220;filtering&#8221; server side, i.e. queries where we know that all (live) record read will be returned (maybe partly) in the result set. The reasoning is that those &#8220;non filtering&#8221; queries have predictable performance in the sense that they will execute in a time that is proportional to the amount of data <strong>returned</strong> by the query (which can be controlled through <code>LIMIT</code>).</p><p>The <code>ALLOW FILTERING</code> option allows to explicitly allow (some) queries that require filtering. Please note that a query using <code>ALLOW FILTERING</code> may
  thus have unpredictable performance (for the definition above), i.e. even a query that selects a handful of records <strong>may</strong> exhibit performance that depends on the total amount of data stored in the cluster.</p><p>For instance, considering the following table holding user profiles with their year of birth (with a secondary index on it) and country of residence:</p><pre class="sample"><pre>CREATE TABLE users (
+</pre></pre><p>The <code>CONTAINS</code> operator may only be used on collection columns (lists, sets, and maps).  In the case of maps, <code>CONTAINS</code> applies to the map values. The <code>CONTAINS KEY</code> operator may only be used on map columns and applies to the map keys.</p><h4 id="selectOrderBy"><code>&lt;order-by></code></h4><p>The <code>ORDER BY</code> option allows to select the order of the returned results. It takes as argument a list of column names along with the order for the column (<code>ASC</code> for ascendant and <code>DESC</code> for descendant, omitting the order being equivalent to <code>ASC</code>). Currently the possible orderings are limited (which depends on the table <a href="#createTableOptions"><code>CLUSTERING ORDER</code></a> ):</p><ul><li>if the table has been defined without any specific <code>CLUSTERING ORDER</code>, then then allowed orderings are the order induced by the clustering columns and the reverse of that one.</li><li>otherwise, th
 e orderings allowed are the order of the <code>CLUSTERING ORDER</code> option and the reversed one.</li></ul><h4 id="selectLimit"><code>LIMIT</code></h4><p>The <code>LIMIT</code> option to a <code>SELECT</code> statement limits the number of rows returned by a query.</p><h4 id="selectAllowFiltering"><code>ALLOW FILTERING</code></h4><p>By default, CQL only allows select queries that don&#8217;t involve &#8220;filtering&#8221; server side, i.e. queries where we know that all (live) record read will be returned (maybe partly) in the result set. The reasoning is that those &#8220;non filtering&#8221; queries have predictable performance in the sense that they will execute in a time that is proportional to the amount of data <strong>returned</strong> by the query (which can be controlled through <code>LIMIT</code>).</p><p>The <code>ALLOW FILTERING</code> option allows to explicitly allow (some) queries that require filtering. Please note that a query using <code>ALLOW FILTERING</code> ma
 y thus have unpredictable performance (for the definition above), i.e. even a query that selects a handful of records <strong>may</strong> exhibit performance that depends on the total amount of data stored in the cluster.</p><p>For instance, considering the following table holding user profiles with their year of birth (with a secondary index on it) and country of residence:</p><pre class="sample"><pre>CREATE TABLE users (
     username text PRIMARY KEY,
     firstname text,
     lastname text,
@@ -572,8 +572,14 @@ UPDATE plays SET scores = scores - [ 12,
     ...
 )
 </pre></pre><p>then the <code>token</code> function will take a single argument of type <code>text</code> (in that case, the partition key is <code>userid</code> (there is no clustering columns so the partition key is the same than the primary key)), and the return type will be <code>bigint</code>.</p><h3 id="uuidFun">Uuid</h3><p>The <code>uuid</code> function takes no parameters and generates a random type 4 uuid suitable for use in INSERT or SET statements.</p><h3 id="timeuuidFun">Timeuuid functions</h3><h4 id="now"><code>now</code></h4><p>The <code>now</code> function takes no arguments and generates a new unique timeuuid (at the time where the statement using it is executed). Note that this method is useful for insertion but is largely non-sensical in <code>WHERE</code> clauses. For instance, a query of the form</p><pre class="sample"><pre>SELECT * FROM myTable WHERE t = now()
-</pre></pre><p>will never return any result by design, since the value returned by <code>now()</code> is guaranteed to be unique.</p><h4 id="minTimeuuidandmaxTimeuuid"><code>minTimeuuid</code> and <code>maxTimeuuid</code></h4><p>The <code>minTimeuuid</code> (resp. <code>maxTimeuuid</code>) function takes a <code>timestamp</code> value <code>t</code> (which can be <a href="#usingtimestamps">either a timestamp or a date string</a>) and return a <em>fake</em> <code>timeuuid</code> corresponding to the <em>smallest</em> (resp. <em>biggest</em>) possible <code>timeuuid</code> having for timestamp <code>t</code>. So for instance:</p> <pre class="sample"><pre>SELECT * FROM myTable WHERE t > maxTimeuuid('2013-01-01 00:05+0000') AND t &lt; minTimeuuid('2013-02-02 10:00+0000')
-</pre></pre> <p>will select all rows where the <code>timeuuid</code> column <code>t</code> is strictly older than &#8216;2013-01-01 00:05+0000&#8217; but strictly younger than &#8216;2013-02-02 10:00+0000&#8217;.  Please note that <code>t >= maxTimeuuid('2013-01-01 00:05+0000')</code> would still <em>not</em> select a <code>timeuuid</code> generated exactly at &#8216;2013-01-01 00:05+0000&#8217; and is essentially equivalent to <code>t > maxTimeuuid('2013-01-01 00:05+0000')</code>.</p><p><em>Warning</em>: We called the values generated by <code>minTimeuuid</code> and <code>maxTimeuuid</code> <em>fake</em> UUID because they do no respect the Time-Based UUID generation process specified by the <a href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122</a>. In particular, the value returned by these 2 methods will not be unique. This means you should only use those methods for querying (as in the example above). Inserting the result of those methods is almost certainly <em>a bad idea</em>.
 </p><h3 id="timeFun">Time conversion functions</h3><p>A number of functions are provided to &#8220;convert&#8221; a <code>timeuuid</code>, a <code>timestamp</code> or a <code>date</code> into another <code>native</code> type.</p><table><tr><th>function name    </th><th>input type   </th><th>description</th></tr><tr><td><code>toDate</code>            </td><td><code>timeuuid</code>      </td><td>Converts the <code>timeuuid</code> argument into a <code>date</code> type</td></tr><tr><td><code>toDate</code>            </td><td><code>timestamp</code>     </td><td>Converts the <code>timestamp</code> argument into a <code>date</code> type</td></tr><tr><td><code>toTimestamp</code>       </td><td><code>timeuuid</code>      </td><td>Converts the <code>timeuuid</code> argument into a <code>timestamp</code> type</td></tr><tr><td><code>toTimestamp</code>       </td><td><code>date</code>          </td><td>Converts the <code>date</code> argument into a <code>timestamp</code> type</td></tr><tr><td><
 code>toUnixTimestamp</code>   </td><td><code>timeuuid</code>      </td><td>Converts the <code>timeuuid</code> argument into a <code>bigInt</code> raw value</td></tr><tr><td><code>toUnixTimestamp</code>   </td><td><code>timestamp</code>     </td><td>Converts the <code>timestamp</code> argument into a <code>bigInt</code> raw value</td></tr><tr><td><code>toUnixTimestamp</code>   </td><td><code>date</code>          </td><td>Converts the <code>date</code> argument into a <code>bigInt</code> raw value</td></tr><tr><td><code>dateOf</code>            </td><td><code>timeuuid</code>      </td><td>Similar to <code>toTimestamp(timeuuid)</code> (DEPRECATED)</td></tr><tr><td><code>unixTimestampOf</code>   </td><td><code>timeuuid</code>      </td><td>Similar to <code>toUnixTimestamp(timeuuid)</code> (DEPRECATED)</td></tr></table><h3 id="blobFun">Blob conversion functions</h3><p>A number of functions are provided to &#8220;convert&#8221; the native types into binary data (<code>blob</code>). For ev
 ery <code>&lt;native-type></code> <code>type</code> supported by CQL3 (a notable exceptions is <code>blob</code>, for obvious reasons), the function <code>typeAsBlob</code> takes a argument of type <code>type</code> and return it as a <code>blob</code>.  Conversely, the function <code>blobAsType</code> takes a 64-bit <code>blob</code> argument and convert it to a <code>bigint</code> value.  And so for instance, <code>bigintAsBlob(3)</code> is <code>0x0000000000000003</code> and <code>blobAsBigint(0x0000000000000003)</code> is <code>3</code>.</p><h2 id="udfs">User-Defined Functions</h2><p>User-defined functions allow execution of user-provided code in Cassandra. By default, Cassandra supports defining functions in <em>Java</em> and <em>JavaScript</em>. Support for other JSR 223 compliant scripting languages (such as Python, Ruby, and Scala) can be added by adding a JAR to the classpath.</p><p>UDFs are part of the Cassandra schema.  As such, they are automatically propagated to all no
 des in the cluster.</p><p>UDFs can be <em>overloaded</em> - i.e. multiple UDFs with different argument types but the same function name. Example:</p><pre class="sample"><pre>CREATE FUNCTION sample ( arg int ) ...;
+</pre></pre><p>will never return any result by design, since the value returned by <code>now()</code> is guaranteed to be unique.</p><h4 id="minTimeuuidandmaxTimeuuid"><code>minTimeuuid</code> and <code>maxTimeuuid</code></h4><p>The <code>minTimeuuid</code> (resp. <code>maxTimeuuid</code>) function takes a <code>timestamp</code> value <code>t</code> (which can be <a href="#usingtimestamps">either a timestamp or a date string</a> ) and return a <em>fake</em> <code>timeuuid</code> corresponding to the <em>smallest</em> (resp. <em>biggest</em>) possible <code>timeuuid</code> having for timestamp <code>t</code>. So for instance:</p><pre class="sample"><pre>SELECT * FROM myTable WHERE t > maxTimeuuid('2013-01-01 00:05+0000') AND t &lt; minTimeuuid('2013-02-02 10:00+0000')
+</pre></pre><p>will select all rows where the <code>timeuuid</code> column <code>t</code> is strictly older than &#8216;2013-01-01 00:05+0000&#8217; but strictly younger than &#8216;2013-02-02 10:00+0000&#8217;.  Please note that <code>t >= maxTimeuuid('2013-01-01 00:05+0000')</code> would still <em>not</em> select a <code>timeuuid</code> generated exactly at &#8216;2013-01-01 00:05+0000&#8217; and is essentially equivalent to <code>t > maxTimeuuid('2013-01-01 00:05+0000')</code>.</p><p><em>Warning</em>: We called the values generated by <code>minTimeuuid</code> and <code>maxTimeuuid</code> <em>fake</em> UUID because they do no respect the Time-Based UUID generation process specified by the <a href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122</a>. In particular, the value returned by these 2 methods will not be unique. This means you should only use those methods for querying (as in the example above). Inserting the result of those methods is almost certainly <em>a bad idea</em>.<
 /p><h3 id="timeFun">Time conversion functions</h3><p>A number of functions are provided to &#8220;convert&#8221; a <code>timeuuid</code>, a <code>timestamp</code> or a <code>date</code> into another <code>native</code> type.</p><table><tr><th>function name    </th><th>input type   </th><th>description</th></tr><tr><td><code>toDate</code>            </td><td><code>timeuuid</code>      </td><td>Converts the <code>timeuuid</code> argument into a <code>date</code> type</td></tr><tr><td><code>toDate</code>            </td><td><code>timestamp</code>     </td><td>Converts the <code>timestamp</code> argument into a <code>date</code> type</td></tr><tr><td><code>toTimestamp</code>       </td><td><code>timeuuid</code>      </td><td>Converts the <code>timeuuid</code> argument into a <code>timestamp</code> type</td></tr><tr><td><code>toTimestamp</code>       </td><td><code>date</code>          </td><td>Converts the <code>date</code> argument into a <code>timestamp</code> type</td></tr><tr><td><c
 ode>toUnixTimestamp</code>   </td><td><code>timeuuid</code>      </td><td>Converts the <code>timeuuid</code> argument into a <code>bigInt</code> raw value</td></tr><tr><td><code>toUnixTimestamp</code>   </td><td><code>timestamp</code>     </td><td>Converts the <code>timestamp</code> argument into a <code>bigInt</code> raw value</td></tr><tr><td><code>toUnixTimestamp</code>   </td><td><code>date</code>          </td><td>Converts the <code>date</code> argument into a <code>bigInt</code> raw value</td></tr><tr><td><code>dateOf</code>            </td><td><code>timeuuid</code>      </td><td>Similar to <code>toTimestamp(timeuuid)</code> (DEPRECATED)</td></tr><tr><td><code>unixTimestampOf</code>   </td><td><code>timeuuid</code>      </td><td>Similar to <code>toUnixTimestamp(timeuuid)</code> (DEPRECATED)</td></tr></table><h3 id="blobFun">Blob conversion functions</h3><p>A number of functions are provided to &#8220;convert&#8221; the native types into binary data (<code>blob</code>). For eve
 ry <code>&lt;native-type></code> <code>type</code> supported by CQL3 (a notable exceptions is <code>blob</code>, for obvious reasons), the function <code>typeAsBlob</code> takes a argument of type <code>type</code> and return it as a <code>blob</code>.  Conversely, the function <code>blobAsType</code> takes a 64-bit <code>blob</code> argument and convert it to a <code>bigint</code> value.  And so for instance, <code>bigintAsBlob(3)</code> is <code>0x0000000000000003</code> and <code>blobAsBigint(0x0000000000000003)</code> is <code>3</code>.</p><h2 id="aggregates">Aggregates</h2><p>CQL3 distinguishes between built-in aggregates (so called &#8216;native aggregates&#8217;) and <a href="#udas">user-defined aggregates</a>.  CQL3 includes several native aggregates, described below:</p><h3 id="countFct">Count</h3><p>The <code>count</code> function can be used to count the rows returned by a query. Example:</p><pre class="sample"><pre>SELECT COUNT(*) FROM plays;
+SELECT COUNT(1) FROM plays;
+</pre></pre><p>It also can be used to count the non null value of a given column. Example:</p><pre class="sample"><pre>SELECT COUNT(scores) FROM plays;
+</pre></pre><h3 id="maxMinFcts">Max and Min</h3><p>The <code>max</code> and <code>min</code> functions can be used to compute the maximum and the minimum value returned by a query for a given column.</p><pre class="sample"><pre>SELECT MIN(players), MAX(players) FROM plays WHERE game = 'quake';
+</pre></pre><h3 id="sumFct">Sum</h3><p>The <code>sum</code> function can be used to sum up all the values returned by a query for a given column.</p><pre class="sample"><pre>SELECT SUM(players) FROM plays;
+</pre></pre><h3 id="avgFct">Avg</h3><p>The <code>avg</code> function can be used to compute the average of all the values returned by a query for a given column.</p><pre class="sample"><pre>SELECT AVG(players) FROM plays;
+</pre></pre><h2 id="udfs">User-Defined Functions</h2><p>User-defined functions allow execution of user-provided code in Cassandra. By default, Cassandra supports defining functions in <em>Java</em> and <em>JavaScript</em>. Support for other JSR 223 compliant scripting languages (such as Python, Ruby, and Scala) can be added by adding a JAR to the classpath.</p><p>UDFs are part of the Cassandra schema.  As such, they are automatically propagated to all nodes in the cluster.</p><p>UDFs can be <em>overloaded</em> - i.e. multiple UDFs with different argument types but the same function name. Example:</p><pre class="sample"><pre>CREATE FUNCTION sample ( arg int ) ...;
 CREATE FUNCTION sample ( arg text ) ...;
 </pre></pre><p>User-defined functions are susceptible to all of the normal problems with the chosen programming language.  Accordingly, implementations should be safe against null pointer exceptions, illegal arguments, or any other potential source of exceptions.  An exception during function execution will result in the entire statement failing.</p><p>It is valid to use <em>complex</em> types like collections, tuple types and user-defined types as argument and return types. Tuple types and user-defined types are handled by the conversion functions of the DataStax Java Driver. Please see the documentation of the Java Driver for details on handling tuple types and user-defined types.</p><p>Arguments for functions can be literals or terms. Prepared statement placeholders can be used, too.</p><p>Note that you can use the double-quoted string syntax to enclose the UDF source code. For example:</p><pre class="sample"><pre>CREATE FUNCTION some_function ( arg int )
   RETURNS NULL ON NULL INPUT
@@ -628,4 +634,4 @@ INSERT INTO atable (pk, val) VALUES (3,3
 INSERT INTO atable (pk, val) VALUES (4,4);
 SELECT average(val) FROM atable;
 </pre></pre><p></p><p>See <a href="#createAggregateStmt"><code>CREATE AGGREGATE</code></a> and <a href="#dropAggregateStmt"><code>DROP AGGREGATE</code></a>.</p><h2 id="json">JSON Support</h2><p>Cassandra 2.2 introduces JSON support to <a href="#selectStmt"><code>SELECT</code></a> and <a href="#insertStmt"><code>INSERT</code></a> statements.  This support does not fundamentally alter the CQL API (for example, the schema is still enforced), it simply provides a convenient way to work with JSON documents.</p><h3 id="selectJson">SELECT JSON</h3><p>With <code>SELECT</code> statements, the new <code>JSON</code> keyword can be used to return each row as a single <code>JSON</code> encoded map.  The remainder of the <code>SELECT</code> statment behavior is the same.</p><p>The result map keys are the same as the column names in a normal result set.  For example, a statement like "<code>SELECT JSON a, ttl(b) FROM ...</code>" would result in a map with keys <code>"a"</code> and <code>"ttl(b)"</
 code>.  However, this is one notable exception: for symmetry with <code>INSERT JSON</code> behavior, case-sensitive column names with upper-case letters will be surrounded with double quotes.  For example, "<code>SELECT JSON myColumn FROM ...</code>" would result in a map key <code>"\"myColumn\""</code> (note the escaped quotes).</p><p>The map values will <code>JSON</code>-encoded representations (as described below) of the result set values.</p><h3 id="insertJson">INSERT JSON</h3><p>With <code>INSERT</code> statements, the new <code>JSON</code> keyword can be used to enable inserting a <code>JSON</code> encoded map as a single row.  The format of the <code>JSON</code> map should generally match that returned by a <code>SELECT JSON</code> statement on the same table.  In particular, case-sensitive column names should be surrounded with double quotes.  For example, to insert into a table with two columns named &#8220;myKey&#8221; and &#8220;value&#8221;, you would do the following:</
 p><pre class="sample"><pre>INSERT INTO mytable JSON '{"\"myKey\"": 0, "value": 0}'
-</pre></pre><p>Any columns which are ommitted from the <code>JSON</code> map will be defaulted to a <code>NULL</code> value (which will result in a tombstone being created).</p><h3 id="jsonEncoding">JSON Encoding of Cassandra Data Types</h3><p>Where possible, Cassandra will represent and accept data types in their native <code>JSON</code> representation.  Cassandra will also accept string representations matching the CQL literal format for all data types.  The following table describes the encodings that Cassandra will accept in <code>INSERT JSON</code> values (and <code>fromJson()</code> arguments) as well as the format Cassandra will use when returning data for <code>SELECT JSON</code> statements (and <code>fromJson()</code>):</p><table><tr><th>type    </th><th>formats accepted   </th><th>return format </th><th>notes</th></tr><tr><td><code>ascii</code>    </td><td>string                </td><td>string           </td><td>Uses JSON&#8217;s <code>\u</code> character escape</td></tr><
 tr><td><code>bigint</code>   </td><td>integer, string       </td><td>integer          </td><td>String must be valid 64 bit integer</td></tr><tr><td><code>blob</code>     </td><td>string                </td><td>string           </td><td>String should be 0x followed by an even number of hex digits</td></tr><tr><td><code>boolean</code>  </td><td>boolean, string       </td><td>boolean          </td><td>String must be &#8220;true&#8221; or "false"</td></tr><tr><td><code>date</code>     </td><td>string                </td><td>string           </td><td>Date in format <code>YYYY-MM-DD</code>, timezone UTC</td></tr><tr><td><code>decimal</code>  </td><td>integer, float, string</td><td>float            </td><td>May exceed 32 or 64-bit IEEE-754 floating point precision in client-side decoder</td></tr><tr><td><code>double</code>   </td><td>integer, float, string</td><td>float            </td><td>String must be valid integer or float</td></tr><tr><td><code>float</code>    </td><td>integer, float,
  string</td><td>float            </td><td>String must be valid integer or float</td></tr><tr><td><code>inet</code>     </td><td>string                </td><td>string           </td><td>IPv4 or IPv6 address</td></tr><tr><td><code>int</code>      </td><td>integer, string       </td><td>integer          </td><td>String must be valid 32 bit integer</td></tr><tr><td><code>list</code>     </td><td>list, string          </td><td>list             </td><td>Uses JSON&#8217;s native list representation</td></tr><tr><td><code>map</code>      </td><td>map, string           </td><td>map              </td><td>Uses JSON&#8217;s native map representation</td></tr><tr><td><code>set</code>      </td><td>list, string          </td><td>list             </td><td>Uses JSON&#8217;s native list representation</td></tr><tr><td><code>text</code>     </td><td>string                </td><td>string           </td><td>Uses JSON&#8217;s <code>\u</code> character escape</td></tr><tr><td><code>time</code>     </td><
 td>string                </td><td>string           </td><td>Time of day in format <code>HH-MM-SS[.fffffffff]</code></td></tr><tr><td><code>timestamp</code></td><td>integer, string       </td><td>string           </td><td>A timestamp. Strings constant are allow to input timestamps as dates, see <a href="#usingdates">Working with dates</a> below for more information.  Datestamps with format <code>YYYY-MM-DD HH:MM:SS.SSS</code> are returned.</td></tr><tr><td><code>timeuuid</code> </td><td>string                </td><td>string           </td><td>Type 1 UUID. See <a href="#constants">Constants</a> for the UUID format</td></tr><tr><td><code>tuple</code>    </td><td>list, string          </td><td>list             </td><td>Uses JSON&#8217;s native list representation</td></tr><tr><td><code>UDT</code>      </td><td>map, string           </td><td>map              </td><td>Uses JSON&#8217;s native map representation with field names as keys</td></tr><tr><td><code>uuid</code>     </td><td>strin
 g                </td><td>string           </td><td>See <a href="#constants">Constants</a> for the UUID format</td></tr><tr><td><code>varchar</code>  </td><td>string                </td><td>string           </td><td>Uses JSON&#8217;s <code>\u</code> character escape</td></tr><tr><td><code>varint</code>   </td><td>integer, string       </td><td>integer          </td><td>Variable length; may overflow 32 or 64 bit integers in client-side decoder</td></tr></table><h3 id="fromJson">The fromJson() Function</h3><p>The <code>fromJson()</code> function may be used similarly to <code>INSERT JSON</code>, but for a single column value.  It may only be used in the <code>VALUES</code> clause of an <code>INSERT</code> statement or as one of the column values in an <code>UPDATE</code>, <code>DELETE</code>, or <code>SELECT</code> statement.  For example, it cannot be used in the selection clause of a <code>SELECT</code> statement.</p><h3 id="toJson">The toJson() Function</h3><p>The <code>toJson()</c
 ode> function may be used similarly to <code>SELECT JSON</code>, but for a single column value.  It may only be used in the selection clause of a <code>SELECT</code> statement.</p><h2 id="appendixA">Appendix A: CQL Keywords</h2><p>CQL distinguishes between <em>reserved</em> and <em>non-reserved</em> keywords. Reserved keywords cannot be used as identifier, they are truly reserved for the language (but one can enclose a reserved keyword by double-quotes to use it as an identifier). Non-reserved keywords however only have a specific meaning in certain context but can used as identifer otherwise. The only <em>raison d'être</em> of these non-reserved keywords is convenience: some keyword are non-reserved when it was always easy for the parser to decide whether they were used as keywords or not.</p><table><tr><th>Keyword      </th><th>Reserved? </th></tr><tr><td><code>ADD</code>          </td><td>yes </td></tr><tr><td><code>AGGREGATE</code>    </td><td>no  </td></tr><tr><td><code>ALL<
 /code>          </td><td>no  </td></tr><tr><td><code>ALLOW</code>        </td><td>yes </td></tr><tr><td><code>ALTER</code>        </td><td>yes </td></tr><tr><td><code>AND</code>          </td><td>yes </td></tr><tr><td><code>APPLY</code>        </td><td>yes </td></tr><tr><td><code>AS</code>           </td><td>no  </td></tr><tr><td><code>ASC</code>          </td><td>yes </td></tr><tr><td><code>ASCII</code>        </td><td>no  </td></tr><tr><td><code>AUTHORIZE</code>    </td><td>yes </td></tr><tr><td><code>BATCH</code>        </td><td>yes </td></tr><tr><td><code>BEGIN</code>        </td><td>yes </td></tr><tr><td><code>BIGINT</code>       </td><td>no  </td></tr><tr><td><code>BLOB</code>         </td><td>no  </td></tr><tr><td><code>BOOLEAN</code>      </td><td>no  </td></tr><tr><td><code>BY</code>           </td><td>yes </td></tr><tr><td><code>CALLED</code>       </td><td>no  </td></tr><tr><td><code>CLUSTERING</code>   </td><td>no  </td></tr><tr><td><code>COLUMNFAMILY</code> </td><td>yes
  </td></tr><tr><td><code>COMPACT</code>      </td><td>no  </td></tr><tr><td><code>CONTAINS</code>     </td><td>no  </td></tr><tr><td><code>COUNT</code>        </td><td>no  </td></tr><tr><td><code>COUNTER</code>      </td><td>no  </td></tr><tr><td><code>CREATE</code>       </td><td>yes </td></tr><tr><td><code>CUSTOM</code>       </td><td>no  </td></tr><tr><td><code>DATE</code>         </td><td>no  </td></tr><tr><td><code>DECIMAL</code>      </td><td>no  </td></tr><tr><td><code>DELETE</code>       </td><td>yes </td></tr><tr><td><code>DESC</code>         </td><td>yes </td></tr><tr><td><code>DESCRIBE</code>     </td><td>yes </td></tr><tr><td><code>DISTINCT</code>     </td><td>no  </td></tr><tr><td><code>DOUBLE</code>       </td><td>no  </td></tr><tr><td><code>DROP</code>         </td><td>yes </td></tr><tr><td><code>ENTRIES</code>      </td><td>yes </td></tr><tr><td><code>EXECUTE</code>      </td><td>yes </td></tr><tr><td><code>EXISTS</code>       </td><td>no  </td></tr><tr><td><code>FIL
 TERING</code>    </td><td>no  </td></tr><tr><td><code>FINALFUNC</code>    </td><td>no  </td></tr><tr><td><code>FLOAT</code>        </td><td>no  </td></tr><tr><td><code>FROM</code>         </td><td>yes </td></tr><tr><td><code>FROZEN</code>       </td><td>no  </td></tr><tr><td><code>FULL</code>         </td><td>yes </td></tr><tr><td><code>FUNCTION</code>     </td><td>no  </td></tr><tr><td><code>FUNCTIONS</code>    </td><td>no  </td></tr><tr><td><code>GRANT</code>        </td><td>yes </td></tr><tr><td><code>IF</code>           </td><td>yes </td></tr><tr><td><code>IN</code>           </td><td>yes </td></tr><tr><td><code>INDEX</code>        </td><td>yes </td></tr><tr><td><code>INET</code>         </td><td>no  </td></tr><tr><td><code>INFINITY</code>     </td><td>yes </td></tr><tr><td><code>INITCOND</code>     </td><td>no  </td></tr><tr><td><code>INPUT</code>        </td><td>no  </td></tr><tr><td><code>INSERT</code>       </td><td>yes </td></tr><tr><td><code>INT</code>          </td><td>no
   </td></tr><tr><td><code>INTO</code>         </td><td>yes </td></tr><tr><td><code>JSON</code>         </td><td>no  </td></tr><tr><td><code>KEY</code>          </td><td>no  </td></tr><tr><td><code>KEYS</code>         </td><td>no  </td></tr><tr><td><code>KEYSPACE</code>     </td><td>yes </td></tr><tr><td><code>KEYSPACES</code>    </td><td>no  </td></tr><tr><td><code>LANGUAGE</code>     </td><td>no  </td></tr><tr><td><code>LIMIT</code>        </td><td>yes </td></tr><tr><td><code>LIST</code>         </td><td>no  </td></tr><tr><td><code>LOGIN</code>        </td><td>no  </td></tr><tr><td><code>MAP</code>          </td><td>no  </td></tr><tr><td><code>MODIFY</code>       </td><td>yes </td></tr><tr><td><code>NAN</code>          </td><td>yes </td></tr><tr><td><code>NOLOGIN</code>      </td><td>no  </td></tr><tr><td><code>NORECURSIVE</code>  </td><td>yes </td></tr><tr><td><code>NOSUPERUSER</code>  </td><td>no  </td></tr><tr><td><code>NOT</code>          </td><td>yes </td></tr><tr><td><code>NU
 LL</code>         </td><td>yes </td></tr><tr><td><code>OF</code>           </td><td>yes </td></tr><tr><td><code>ON</code>           </td><td>yes </td></tr><tr><td><code>OPTIONS</code>      </td><td>no  </td></tr><tr><td><code>OR</code>           </td><td>yes </td></tr><tr><td><code>ORDER</code>        </td><td>yes </td></tr><tr><td><code>PASSWORD</code>     </td><td>no  </td></tr><tr><td><code>PERMISSION</code>   </td><td>no  </td></tr><tr><td><code>PERMISSIONS</code>  </td><td>no  </td></tr><tr><td><code>PRIMARY</code>      </td><td>yes </td></tr><tr><td><code>RENAME</code>       </td><td>yes </td></tr><tr><td><code>REPLACE</code>      </td><td>yes </td></tr><tr><td><code>RETURNS</code>      </td><td>no  </td></tr><tr><td><code>REVOKE</code>       </td><td>yes </td></tr><tr><td><code>ROLE</code>         </td><td>no  </td></tr><tr><td><code>ROLES</code>        </td><td>no  </td></tr><tr><td><code>SCHEMA</code>       </td><td>yes </td></tr><tr><td><code>SELECT</code>       </td><td>y
 es </td></tr><tr><td><code>SET</code>          </td><td>yes </td></tr><tr><td><code>SFUNC</code>        </td><td>no  </td></tr><tr><td><code>SMALLINT</code>     </td><td>no  </td></tr><tr><td><code>STATIC</code>       </td><td>no  </td></tr><tr><td><code>STORAGE</code>      </td><td>no  </td></tr><tr><td><code>STYPE</code>        </td><td>no  </td></tr><tr><td><code>SUPERUSER</code>    </td><td>no  </td></tr><tr><td><code>TABLE</code>        </td><td>yes </td></tr><tr><td><code>TEXT</code>         </td><td>no  </td></tr><tr><td><code>TIME</code>         </td><td>no  </td></tr><tr><td><code>TIMESTAMP</code>    </td><td>no  </td></tr><tr><td><code>TIMEUUID</code>     </td><td>no  </td></tr><tr><td><code>TINYINT</code>      </td><td>no  </td></tr><tr><td><code>TO</code>           </td><td>yes </td></tr><tr><td><code>TOKEN</code>        </td><td>yes </td></tr><tr><td><code>TRIGGER</code>      </td><td>no  </td></tr><tr><td><code>TRUNCATE</code>     </td><td>yes </td></tr><tr><td><code>T
 TL</code>          </td><td>no  </td></tr><tr><td><code>TUPLE</code>        </td><td>no  </td></tr><tr><td><code>TYPE</code>         </td><td>no  </td></tr><tr><td><code>UNLOGGED</code>     </td><td>yes </td></tr><tr><td><code>UPDATE</code>       </td><td>yes </td></tr><tr><td><code>USE</code>          </td><td>yes </td></tr><tr><td><code>USER</code>         </td><td>no  </td></tr><tr><td><code>USERS</code>        </td><td>no  </td></tr><tr><td><code>USING</code>        </td><td>yes </td></tr><tr><td><code>UUID</code>         </td><td>no  </td></tr><tr><td><code>VALUES</code>       </td><td>no  </td></tr><tr><td><code>VARCHAR</code>      </td><td>no  </td></tr><tr><td><code>VARINT</code>       </td><td>no  </td></tr><tr><td><code>WHERE</code>        </td><td>yes </td></tr><tr><td><code>WITH</code>         </td><td>yes </td></tr><tr><td><code>WRITETIME</code>    </td><td>no  </td></tr></table><h2 id="appendixB">Appendix B: CQL Reserved Types</h2><p>The following type names are not cu
 rrently used by CQL, but are reserved for potential future use.  User-defined types may not use reserved type names as their name.</p><table><tr><th>type      </th></tr><tr><td><code>bitstring</code> </td></tr><tr><td><code>byte</code>      </td></tr><tr><td><code>complex</code>   </td></tr><tr><td><code>date</code>      </td></tr><tr><td><code>enum</code>      </td></tr><tr><td><code>interval</code>  </td></tr><tr><td><code>macaddr</code>   </td></tr><tr><td><code>smallint</code>  </td></tr></table><h2 id="changes">Changes</h2><p>The following describes the changes in each version of CQL.</p><h3 id="a3.3.0">3.3.0</h3><ul><li>User-defined functions are now supported through <a href="#createFunctionStmt"><code>CREATE FUNCTION</code></a> and <a href="#dropFunctionStmt"><code>DROP FUNCTION</code></a>, </li><li>User-defined aggregates are now supported through <a href="#createAggregateStmt"><code>CREATE AGGREGATE</code></a> and <a href="#dropAggregateStmt"><code>DROP AGGREGATE</code></a
 >.</li><li>Allows double-dollar enclosed strings literals as an alternative to single-quote enclosed strings.</li><li>Introduces Roles to supercede user based authentication and access control</li></ul><h3 id="a3.2.0">3.2.0</h3><ul><li>User-defined types are now supported through <a href="#createTypeStmt"><code>CREATE TYPE</code></a>, <a href="#alterTypeStmt"><code>ALTER TYPE</code></a>, and <a href="#dropTypeStmt"><code>DROP TYPE</code></a></li><li><a href="#createIndexStmt"><code>CREATE INDEX</code></a> now supports indexing collection columns, including indexing the keys of map collections through the <code>keys()</code> function</li><li>Indexes on collections may be queried using the new <code>CONTAINS</code> and <code>CONTAINS KEY</code> operators</li><li>Tuple types were added to hold fixed-length sets of typed positional fields (see the section on <a href="#types">types</a>)</li><li><a href="#dropIndexStmt"><code>DROP INDEX</code></a> now supports optionally specifying a keys
 pace</li></ul><h3 id="a3.1.7">3.1.7</h3><ul><li><code>SELECT</code> statements now support selecting multiple rows in a single partition using an <code>IN</code> clause on combinations of clustering columns.  See <a href="#selectWhere">SELECT WHERE</a> clauses.</li><li><code>IF NOT EXISTS</code> and <code>IF EXISTS</code> syntax is now supported by <code>CREATE USER</code> and <code>DROP USER</code> statmenets, respectively.</li></ul><h3 id="a3.1.6">3.1.6</h3><ul><li>A new <a href="#uuidFun"><code>uuid</code> method</a> has been added.</li><li>Support for <code>DELETE ... IF EXISTS</code> syntax.</li></ul><h3 id="a3.1.5">3.1.5</h3><ul><li>It is now possible to group clustering columns in a relatiion, see <a href="#selectWhere">SELECT WHERE</a> clauses.</li><li>Added support for <code>STATIC</code> columns, see <a href="#createTableStatic">static in CREATE TABLE</a>.</li></ul><h3 id="a3.1.4">3.1.4</h3><ul><li><code>CREATE INDEX</code> now allows specifying options when creating CUSTO
 M indexes (see <a href="#createIndexStmt">CREATE INDEX reference</a>).</li></ul><h3 id="a3.1.3">3.1.3</h3><ul><li>Millisecond precision formats have been added to the timestamp parser (see <a href="#usingtimestamps">working with dates</a>).</li></ul><h3 id="a3.1.2">3.1.2</h3><ul><li><code>NaN</code> and <code>Infinity</code> has been added as valid float contants. They are now reserved keywords. In the unlikely case you we using them as a column identifier (or keyspace/table one), you will noew need to double quote them (see <a href="#identifiers">quote identifiers</a>).</li></ul><h3 id="a3.1.1">3.1.1</h3><ul><li><code>SELECT</code> statement now allows listing the partition keys (using the <code>DISTINCT</code> modifier). See <a href="https://issues.apache.org/jira/browse/CASSANDRA-4536">CASSANDRA-4536</a>.</li><li>The syntax <code>c IN ?</code> is now supported in <code>WHERE</code> clauses. In that case, the value expected for the bind variable will be a list of whatever type <co
 de>c</code> is.</li><li>It is now possible to use named bind variables (using <code>:name</code> instead of <code>?</code>).</li></ul><h3 id="a3.1.0">3.1.0</h3><ul><li><a href="#alterTableStmt">ALTER TABLE</a> <code>DROP</code> option has been reenabled for CQL3 tables and has new semantics now: the space formerly used by dropped columns will now be eventually reclaimed (post-compaction). You should not readd previously dropped columns unless you use timestamps with microsecond precision (see <a href="https://issues.apache.org/jira/browse/CASSANDRA-3919">CASSANDRA-3919</a> for more details).</li><li><code>SELECT</code> statement now supports aliases in select clause. Aliases in WHERE and ORDER BY clauses are not supported. See the <a href="#selectStmt">section on select</a> for details.</li><li><code>CREATE</code> statements for <code>KEYSPACE</code>, <code>TABLE</code> and <code>INDEX</code> now supports an <code>IF NOT EXISTS</code> condition. Similarly, <code>DROP</code> statemen
 ts support a <code>IF EXISTS</code> condition.</li><li><code>INSERT</code> statements optionally supports a <code>IF NOT EXISTS</code> condition and <code>UPDATE</code> supports <code>IF</code> conditions.</li></ul><h3 id="a3.0.5">3.0.5</h3><ul><li><code>SELECT</code>, <code>UPDATE</code>, and <code>DELETE</code> statements now allow empty <code>IN</code> relations (see <a href="https://issues.apache.org/jira/browse/CASSANDRA-5626">CASSANDRA-5626</a>).</li></ul><h3 id="a3.0.4">3.0.4</h3><ul><li>Updated the syntax for custom <a href="#createIndexStmt">secondary indexes</a>.</li><li>Non-equal condition on the partition key are now never supported, even for ordering partitioner as this was not correct (the order was <strong>not</strong> the one of the type of the partition key). Instead, the <code>token</code> method should always be used for range queries on the partition key (see <a href="#selectWhere">WHERE clauses</a>).</li></ul><h3 id="a3.0.3">3.0.3</h3><ul><li>Support for custom 
 <a href="#createIndexStmt">secondary indexes</a> has been added.</li></ul><h3 id="a3.0.2">3.0.2</h3><ul><li>Type validation for the <a href="#constants">constants</a> has been fixed. For instance, the implementation used to allow <code>'2'</code> as a valid value for an <code>int</code> column (interpreting it has the equivalent of <code>2</code>), or <code>42</code> as a valid <code>blob</code> value (in which case <code>42</code> was interpreted as an hexadecimal representation of the blob). This is no longer the case, type validation of constants is now more strict. See the <a href="#types">data types</a> section for details on which constant is allowed for which type.</li><li>The type validation fixed of the previous point has lead to the introduction of <a href="#constants">blobs constants</a> to allow inputing blobs. Do note that while inputing blobs as strings constant is still supported by this version (to allow smoother transition to blob constant), it is now deprecated (in
  particular the <a href="#types">data types</a> section does not list strings constants as valid blobs) and will be removed by a future version. If you were using strings as blobs, you should thus update your client code ASAP to switch blob constants.</li><li>A number of functions to convert native types to blobs have also been introduced. Furthermore the token function is now also allowed in select clauses. See the <a href="#functions">section on functions</a> for details.</li></ul><h3 id="a3.0.1">3.0.1</h3><ul><li><a href="#usingtimestamps">Date strings</a> (and timestamps) are no longer accepted as valid <code>timeuuid</code> values. Doing so was a bug in the sense that date string are not valid <code>timeuuid</code>, and it was thus resulting in <a href="https://issues.apache.org/jira/browse/CASSANDRA-4936">confusing behaviors</a>.  However, the following new methods have been added to help working with <code>timeuuid</code>: <code>now</code>, <code>minTimeuuid</code>, <code>max
 Timeuuid</code> , <code>dateOf</code> and <code>unixTimestampOf</code>. See the <a href="#usingtimeuuid">section dedicated to these methods</a> for more detail.</li><li>&#8220;Float constants&#8221;#constants now support the exponent notation. In other words, <code>4.2E10</code> is now a valid floating point value.</li></ul><h2 id="Versioning">Versioning</h2><p>Versioning of the CQL language adheres to the <a href="http://semver.org">Semantic Versioning</a> guidelines. Versions take the form X.Y.Z where X, Y, and Z are integer values representing major, minor, and patch level respectively. There is no correlation between Cassandra release versions and the CQL language version.</p><table><tr><th>version</th><th>description</th></tr><tr><td>Major     </td><td>The major version <em>must</em> be bumped when backward incompatible changes are introduced. This should rarely occur.</td></tr><tr><td>Minor     </td><td>Minor version increments occur when new, but backward compatible, function
 ality is introduced.</td></tr><tr><td>Patch     </td><td>The patch version is incremented when bugs are fixed.</td></tr></table></body></html>
\ No newline at end of file

[... 3 lines stripped ...]