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/06/03 23:30:33 UTC

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

Author: tylerhobbs
Date: Wed Jun  3 21:30:33 2015
New Revision: 1683428

URL: http://svn.apache.org/r1683428
Log:
Update CQL docs for 2.2 to the latest

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=1683428&r1=1683427&r2=1683428&view=diff
==============================================================================
--- cassandra/site/publish/doc/cql3/CQL-2.2.html (original)
+++ cassandra/site/publish/doc/cql3/CQL-2.2.html Wed Jun  3 21:30:33 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#types">Data Types</a><ol style="li
 st-style: none;"><li><a href="CQL-2.2.html#usingtimestamps">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#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></l
 i><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>
+<?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#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 Enc
 oding 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 i
 n 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 lang="a-zA-Z">[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 to use u
 pper 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 lang="a-zA-Z">[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>"fo
 o "" 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> constant is defined b
 y <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
@@ -387,7 +387,120 @@ CREATE INDEX ON users(birth_year);
 SELECT firstname, lastname FROM users WHERE birth_year = 1981;
 </pre></pre><p>because in both case, Cassandra guarantees that these queries performance will be proportional to the amount of data returned. In particular, if no users are born in 1981, then the second query performance will not depend of the number of user profile stored in the database (not directly at least: due to secondary index implementation consideration, this query may still depend on the number of node in the cluster, which indirectly depends on the amount of data stored.  Nevertheless, the number of nodes will always be multiple number of magnitude lower than the number of user profile stored). Of course, both query may return very large result set in practice, but the amount of data returned can always be controlled by adding a <code>LIMIT</code>.</p><p>However, the following query will be rejected:</p><pre class="sample"><pre>SELECT firstname, lastname FROM users WHERE birth_year = 1981 AND country = 'FR';
 </pre></pre><p>because Cassandra cannot guarantee that it won&#8217;t have to scan large amount of data even if the result to those query is small. Typically, it will scan all the index entries for users born in 1981 even if only a handful are actually from France. However, if you &#8220;know what you are doing&#8221;, you can force the execution of this query by using <code>ALLOW FILTERING</code> and so the following query is valid:</p><pre class="sample"><pre>SELECT firstname, lastname FROM users WHERE birth_year = 1981 AND country = 'FR' ALLOW FILTERING;
-</pre></pre><h2 id="types">Data Types</h2><p>CQL supports a rich set of data types for columns defined in a table, including collection types. On top of those native and collection types, users can also provide custom types (through a JAVA class extending <code>AbstractType</code> loadable by Cassandra). The syntax of types is thus:</p><pre class="syntax"><pre>&lt;type> ::= &lt;native-type>
+</pre></pre><h2 id="databaseRoles">Database Roles</h2><h3 id="createRoleStmt">CREATE ROLE</h3><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;create-role-stmt> ::= CREATE ROLE ( IF NOT EXISTS )? &lt;identifier> ( WITH &lt;option> ( AND &lt;option> )* )?
+
+&lt;option> ::= PASSWORD = &lt;string>
+           | LOGIN = &lt;boolean>
+           | SUPERUSER = &lt;boolean>
+           | OPTIONS = &lt;map_literal>
+</pre></pre><p></p><p><i>Sample:</i></p><pre class="sample"><pre>CREATE ROLE new_role;
+CREATE ROLE alice WITH PASSWORD = 'password_a' AND LOGIN = true;
+CREATE ROLE bob WITH PASSWORD = 'password_b' AND LOGIN = true AND SUPERUSER = true;
+CREATE ROLE carlos WITH OPTIONS = { 'custom_option1' : 'option1_value', 'custom_option2' : 99 };
+</pre></pre><p>By default roles do not possess <code>LOGIN</code> privileges or <code>SUPERUSER</code> status.</p><p><a href="#permissions">Permissions</a> on database resources are granted to roles; types of resources include keyspaces, tables, functions and roles themselves. Roles may be granted to other roles to create hierarchical permissions structures; in these hierarchies, permissions and <code>SUPERUSER</code> status are inherited, but the <code>LOGIN</code> privilege is not. </p><p>If a role has the <code>LOGIN</code> privilege, clients may identify as that role when connecting. For the duration of that connection, the client will acquire any roles and privileges granted to that role.</p><p>Only a client with with the <code>CREATE</code> permission on the database roles resource may issue <code>CREATE ROLE</code> requests (see the <a href="#permissions">relevant section</a> below), unless the client is a <code>SUPERUSER</code>. Role management in Cassandra is pluggable and 
 custom implementations may support only a subset of the listed options.</p><p>Role names should be quoted if they contain non-alphanumeric characters. </p><h4 id="createRolePwd">Setting credentials for internal authentication</h4><p>Use the <code>WITH PASSWORD</code> clause to set a password for internal authentication, enclosing the password in single quotation marks.<br/>If internal authentication has not been set up or the role does not have <code>LOGIN</code> privileges, the <code>WITH PASSWORD</code> clause is not necessary.</p><h4 id="createRoleConditional">Creating a role conditionally</h4><p>Attempting to create an existing role results in an invalid query condition unless the <code>IF NOT EXISTS</code> option is used. If the option is used and the role exists, the statement is a no-op.</p><pre class="sample"><pre>CREATE ROLE other_role;
+CREATE ROLE IF NOT EXISTS other_role;
+</pre></pre><h3 id="alterRoleStmt">ALTER ROLE</h3><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;alter-role-stmt> ::= ALTER ROLE &lt;identifier> ( WITH &lt;option> ( AND &lt;option> )* )?
+
+&lt;option> ::= PASSWORD = &lt;string>
+           | LOGIN = &lt;boolean>
+           | SUPERUSER = &lt;boolean>
+           | OPTIONS = &lt;map_literal>
+</pre></pre><p></p><p><i>Sample:</i></p><pre class="sample"><pre>ALTER ROLE bob WITH PASSWORD = 'PASSWORD_B' AND SUPERUSER = false;
+</pre></pre><p>Conditions on executing <code>ALTER ROLE</code> statements:</p><ul><li>A client must have <code>SUPERUSER</code> status to alter the <code>SUPERUSER</code> status of another role</li><li>A client cannot alter the <code>SUPERUSER</code> status of any role it currently holds</li><li>A client can only modify certain properties of the role with which it identified at login (e.g. <code>PASSWORD</code>)</li><li>To modify properties of a role, the client must be granted <code>ALTER</code> <a href="#permissions">permission</a> on that role</li></ul><h3 id="dropRoleStmt">DROP ROLE</h3><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;drop-role-stmt> ::= DROP ROLE ( IF EXISTS )? &lt;identifier>
+</pre></pre><p></p><p><i>Sample:</i></p><pre class="sample"><pre>DROP ROLE alice;
+DROP ROLE IF EXISTS bob;
+</pre></pre><p><code>DROP ROLE</code> requires the client to have <code>DROP</code> <a href="#permissions">permission</a> on the role in question. In addition, client may not <code>DROP</code> the role with which it identified at login. Finaly, only a client with <code>SUPERUSER</code> status may <code>DROP</code> another <code>SUPERUSER</code> role.<br/>Attempting to drop a role which does not exist results in an invalid query condition unless the <code>IF EXISTS</code> option is used. If the option is used and the role does not exist the statement is a no-op. </p><h3 id="grantRoleStmt">GRANT ROLE</h3><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;grant-role-stmt> ::= GRANT &lt;identifier> TO &lt;identifier>
+</pre></pre><p><i>Sample:</i></p><pre class="sample"><pre>GRANT report_writer TO alice;
+</pre></pre><p>This statement grants the <code>report_writer</code> role to <code>alice</code>. Any permissions granted to <code>report_writer</code> are also acquired by <code>alice</code>.<br/>Roles are modelled as a directed acyclic graph, so circular grants are not permitted. The following examples result in error conditions:</p><pre class="sample"><pre>GRANT role_a TO role_b;
+GRANT role_b TO role_a;
+</pre></pre><pre class="sample"><pre>GRANT role_a TO role_b;
+GRANT role_b TO role_c;
+GRANT role_c TO role_a;
+</pre></pre><h3 id="revokeRoleStmt">REVOKE ROLE</h3><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;revoke-role-stmt> ::= REVOKE &lt;identifier> FROM &lt;identifier>
+</pre></pre><p><i>Sample:</i></p><pre class="sample"><pre>REVOKE report_writer FROM alice;
+</pre></pre><p>This statement revokes the <code>report_writer</code> role from <code>alice</code>. Any permissions that <code>alice</code> has acquired via the <code>report_writer</code> role are also revoked. </p><h4 id="listRolesStmt">LIST ROLES</h4><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;list-roles-stmt> ::= LIST ROLES ( OF &lt;identifier> )? ( NORECURSIVE )?
+</pre></pre><p><i>Sample:</i> </p><pre class="sample"><pre>LIST ROLES;
+</pre></pre><p>Return all known roles in the system, this requires <code>DESCRIBE</code> permission on the database roles resource.</p><pre class="sample"><pre>LIST ROLES OF @alice@;
+</pre></pre><p>Enumerate all roles granted to <code>alice</code>, including those transitively aquired.</p><pre class="sample"><pre>LIST ROLES OF @bob@ NORECURSIVE
+</pre></pre><p>List all roles directly granted to <code>bob</code>.</p><h3 id="createUserStmt">CREATE USER </h3><p>Prior to the introduction of roles in Cassandra 2.2, authentication and authorization were based around the concept of a <code>USER</code>. For backward compatibility, the legacy syntax has been preserved with <code>USER</code> centric statments becoming synonyms for the <code>ROLE</code> based equivalents.</p><p><i>Syntax:</i> </p><pre class="syntax"><pre>&lt;create-user-statement> ::= CREATE USER ( IF NOT EXISTS )? &lt;identifier> ( WITH PASSWORD &lt;string> )? (&lt;option>)?
+
+&lt;option> ::= SUPERUSER
+           | NOSUPERUSER
+</pre></pre><p></p><p><i>Sample:</i> </p><pre class="sample"><pre>CREATE USER alice WITH PASSWORD 'password_a' SUPERUSER;
+CREATE USER bob WITH PASSWORD 'password_b' NOSUPERUSER;
+</pre></pre><p><code>CREATE USER</code> is equivalent to <code>CREATE ROLE</code> where the <code>LOGIN</code> option is <code>true</code>. So, the following pairs of statements are equivalent:</p><pre class="sample"><pre>CREATE USER alice WITH PASSWORD 'password_a' SUPERUSER;
+CREATE ROLE alice WITH PASSWORD = 'password_a' AND LOGIN = true AND SUPERUSER = true;
+
+CREATE USER IF EXISTS alice WITH PASSWORD 'password_a' SUPERUSER;
+CREATE ROLE IF EXISTS alice WITH PASSWORD = 'password_a' AND LOGIN = true AND SUPERUSER = true;
+
+CREATE USER alice WITH PASSWORD 'password_a' NOSUPERUSER;
+CREATE ROLE alice WITH PASSWORD = 'password_a' AND LOGIN = true AND SUPERUSER = false;
+
+CREATE USER alice WITH PASSWORD 'password_a' NOSUPERUSER;
+CREATE ROLE alice WITH PASSWORD = 'password_a' WITH LOGIN = true;
+
+CREATE USER alice WITH PASSWORD 'password_a';
+CREATE ROLE alice WITH PASSWORD = 'password_a' WITH LOGIN = true;
+</pre></pre><p></p><h3 id="alterUserStmt">ALTER USER </h3><p><i>Syntax:</i> </p><pre class="syntax"><pre>&lt;alter-user-statement> ::= ALTER USER &lt;identifier> ( WITH PASSWORD &lt;string> )? ( &lt;option> )?
+
+&lt;option> ::= SUPERUSER
+           | NOSUPERUSER
+</pre></pre><p></p><pre class="sample"><pre>ALTER USER alice WITH PASSWORD 'PASSWORD_A';
+ALTER USER bob SUPERUSER;
+</pre></pre><h3 id="dropUserStmt">DROP USER </h3><p><i>Syntax:</i> </p><pre class="syntax"><pre>&lt;drop-user-stmt> ::= DROP USER ( IF EXISTS )? &lt;identifier>
+</pre></pre><p></p><p><i>Sample:</i> </p><pre class="sample"><pre>DROP USER alice;
+DROP USER IF EXISTS bob;
+</pre></pre><h3 id="listUsersStmt">LIST USERS</h3><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;list-users-stmt> ::= LIST USERS;
+</pre></pre><p><i>Sample:</i></p><pre class="sample"><pre>LIST USERS;
+</pre></pre><p>This statement is equivalent to</p><pre class="sample"><pre>LIST ROLES;
+</pre></pre><p>but only roles with the <code>LOGIN</code> privilege are included in the output.</p><h2 id="dataControl">Data Control</h2><h3 id="permissions">Permissions </h3><p>Permissions on resources are granted to roles; there are several different types of resources in Cassandra and each type is modelled hierarchically:</p><ul><li>The hierarchy of Data resources, Keyspaces and Tables has the structure <code>ALL KEYSPACES</code> -> <code>KEYSPACE</code> -> <code>TABLE</code></li><li>Function resources have the structure <code>ALL FUNCTIONS</code> -> <code>KEYSPACE</code> -> <code>FUNCTION</code></li><li>Resources representing roles have the structure <code>ALL ROLES</code> -> <code>ROLE</code></li></ul><p>Permissions can be granted at any level of these hierarchies and they flow downwards. So granting a permission on a resource higher up the chain automatically grants that same permission on all resources lower down. For example, granting <code>SELECT</code> on a <code>KEYSPACE<
 /code> automatically grants it on all <code>TABLES</code> in that <code>KEYSPACE</code>. Likewise, granting a permission on <code>ALL FUNCTIONS</code> grants it on every defined function, regardless of which keyspace it is scoped in. It is also possible to grant permissions on all functions scoped to a particular keyspace. </p><p>Modifications to permissions are visible to existing client sessions; that is, connections need not be re-established following permissions changes.</p><p>The full set of available permissions is:</p><ul><li><code>CREATE</code></li><li><code>ALTER</code></li><li><code>DROP</code></li><li><code>SELECT</code></li><li><code>MODIFY</code></li><li><code>AUTHORIZE</code></li><li><code>DESCRIBE</code></li><li><code>EXECUTE</code></li></ul><p>Not all permissions are applicable to every type of resource. For instance, <code>EXECUTE</code> is only relevant in the context of functions; granting <code>EXECUTE</code> on a resource representing a table is nonsensical. At
 tempting to <code>GRANT</code> a permission on resource to which it cannot be applied results in an error response. The following illustrates which permissions can be granted on which types of resource, and which statements are enabled by that permission.</p><table><tr><th>permission </th><th>resource                   </th><th>operations        </th></tr><tr><td><code>CREATE</code>     </td><td><code>ALL KEYSPACES</code>              </td><td><code>CREATE KEYSPACE</code> <br> <code>CREATE TABLE</code> in any keyspace</td></tr><tr><td><code>CREATE</code>     </td><td><code>KEYSPACE</code>                   </td><td><code>CREATE TABLE</code> in specified keyspace</td></tr><tr><td><code>CREATE</code>     </td><td><code>ALL FUNCTIONS</code>              </td><td><code>CREATE FUNCTION</code> in any keyspace <br> <code>CREATE AGGREGATE</code> in any keyspace</td></tr><tr><td><code>CREATE</code>     </td><td><code>ALL FUNCTIONS IN KEYSPACE</code>  </td><td><code>CREATE FUNCTION</code> in 
 keyspace <br> <code>CREATE AGGREGATE</code> in keyspace</td></tr><tr><td><code>CREATE</code>     </td><td><code>ALL ROLES</code>                  </td><td><code>CREATE ROLE</code></td></tr><tr><td><code>ALTER</code>      </td><td><code>ALL KEYSPACES</code>              </td><td><code>ALTER KEYSPACE</code> <br> <code>ALTER TABLE</code> in any keyspace</td></tr><tr><td><code>ALTER</code>      </td><td><code>KEYSPACE</code>                   </td><td><code>ALTER KEYSPACE</code> <br> <code>ALTER TABLE</code> in keyspace</td></tr><tr><td><code>ALTER</code>      </td><td><code>TABLE</code>                      </td><td><code>ALTER TABLE</code></td></tr><tr><td><code>ALTER</code>      </td><td><code>ALL FUNCTIONS</code>              </td><td><code>CREATE FUNCTION</code> replacing any existing <br> <code>CREATE AGGREGATE</code> replacing any existing</td></tr><tr><td><code>ALTER</code>      </td><td><code>ALL FUNCTIONS IN KEYSPACE</code>  </td><td><code>CREATE FUNCTION</code> replacing exis
 ting in keyspace <br> <code>CREATE AGGREGATE</code> replacing any existing in keyspace</td></tr><tr><td><code>ALTER</code>      </td><td><code>FUNCTION</code>                   </td><td><code>CREATE FUNCTION</code> replacing existing <br> <code>CREATE AGGREGATE</code> replacing existing</td></tr><tr><td><code>ALTER</code>      </td><td><code>ALL ROLES</code>                  </td><td><code>ALTER ROLE</code> on any role</td></tr><tr><td><code>ALTER</code>      </td><td><code>ROLE</code>                       </td><td><code>ALTER ROLE</code></td></tr><tr><td><code>DROP</code>       </td><td><code>ALL KEYSPACES</code>              </td><td><code>DROP KEYSPACE</code> <br> <code>DROP TABLE</code> in any keyspace</td></tr><tr><td><code>DROP</code>       </td><td><code>KEYSPACE</code>                   </td><td><code>DROP TABLE</code> in specified keyspace</td></tr><tr><td><code>DROP</code>       </td><td><code>TABLE</code>                      </td><td><code>DROP TABLE</code></td></tr><tr
 ><td><code>DROP</code>       </td><td><code>ALL FUNCTIONS</code>              </td><td><code>DROP FUNCTION</code> in any keyspace <br> <code>DROP AGGREGATE</code> in any existing</td></tr><tr><td><code>DROP</code>       </td><td><code>ALL FUNCTIONS IN KEYSPACE</code>  </td><td><code>DROP FUNCTION</code> in keyspace <br> <code>DROP AGGREGATE</code> in existing</td></tr><tr><td><code>DROP</code>       </td><td><code>FUNCTION</code>                   </td><td><code>DROP FUNCTION</code></td></tr><tr><td><code>DROP</code>       </td><td><code>ALL ROLES</code>                  </td><td><code>DROP ROLE</code> on any role</td></tr><tr><td><code>DROP</code>       </td><td><code>ROLE</code>                       </td><td><code>DROP ROLE</code></td></tr><tr><td><code>SELECT</code>     </td><td><code>ALL KEYSPACES</code>              </td><td><code>SELECT</code> on any table</td></tr><tr><td><code>SELECT</code>     </td><td><code>KEYSPACE</code>                   </td><td><code>SELECT</code> on
  any table in keyspace</td></tr><tr><td><code>SELECT</code>     </td><td><code>TABLE</code>                      </td><td><code>SELECT</code> on specified table</td></tr><tr><td><code>MODIFY</code>     </td><td><code>ALL KEYSPACES</code>              </td><td><code>INSERT</code> on any table <br> <code>UPDATE</code> on any table <br> <code>DELETE</code> on any table <br> <code>TRUNCATE</code> on any table</td></tr><tr><td><code>MODIFY</code>     </td><td><code>KEYSPACE</code>                  </td><td><code>INSERT</code> on any table in keyspace <br> <code>UPDATE</code> on any table in keyspace <br>  == @DELETE@ on any table in keyspace ==<br> <code>TRUNCATE</code> on any table in keyspace</td></tr><tr><td><code>MODIFY</code>     </td><td><code>TABLE</code>                      </td><td><code>INSERT</code> <br> <code>UPDATE</code> <br> <code>DELETE</code> <br> <code>TRUNCATE</code></td></tr><tr><td><code>AUTHORIZE</code>  </td><td><code>ALL KEYSPACES</code>              </td><td><co
 de>GRANT PERMISSION</code> on any table <br> <code>REVOKE PERMISSION</code> on any table</td></tr><tr><td><code>AUTHORIZE</code>  </td><td><code>KEYSPACE</code>                   </td><td><code>GRANT PERMISSION</code> on table in keyspace <br> <code>REVOKE PERMISSION</code> on table in keyspace</td></tr><tr><td><code>AUTHORIZE</code>  </td><td><code>TABLE</code>                      </td><td><code>GRANT PERMISSION</code> <br> <code>REVOKE PERMISSION</code> </td></tr><tr><td><code>AUTHORIZE</code>  </td><td><code>ALL FUNCTIONS</code>              </td><td><code>GRANT PERMISSION</code> on any function <br> <code>REVOKE PERMISSION</code> on any function</td></tr><tr><td><code>AUTHORIZE</code>  </td><td><code>ALL FUNCTIONS IN KEYSPACE</code>  </td><td><code>GRANT PERMISSION</code> in keyspace <br> <code>REVOKE PERMISSION</code> in keyspace</td></tr><tr><td><code>AUTHORIZE</code>  </td><td><code>ALL FUNCTIONS IN KEYSPACE</code>  </td><td><code>GRANT PERMISSION</code> in keyspace <br> <co
 de>REVOKE PERMISSION</code> in keyspace</td></tr><tr><td><code>AUTHORIZE</code>  </td><td><code>FUNCTION</code>                   </td><td><code>GRANT PERMISSION</code> <br> <code>REVOKE PERMISSION</code></td></tr><tr><td><code>AUTHORIZE</code>  </td><td><code>ALL ROLES</code>                  </td><td><code>GRANT ROLE</code> grant any role <br> <code>REVOKE ROLE</code> revoke any role</td></tr><tr><td><code>AUTHORIZE</code>  </td><td><code>ROLES</code>                      </td><td><code>GRANT ROLE</code> grant role <br> <code>REVOKE ROLE</code> revoke role</td></tr><tr><td><code>DESCRIBE</code>   </td><td><code>ALL ROLES</code>                  </td><td><code>LIST ROLES</code> all roles or only roles granted to another, specified role</td></tr><tr><td><code>EXECUTE</code>    </td><td><code>ALL FUNCTIONS</code>              </td><td><code>SELECT</code>, <code>INSERT</code>, <code>UPDATE</code> using any function <br> use of any function in <code>CREATE AGGREGATE</code></td></tr><tr
 ><td><code>EXECUTE</code>    </td><td><code>ALL FUNCTIONS IN KEYSPACE</code>  </td><td><code>SELECT</code>, <code>INSERT</code>, <code>UPDATE</code> using any function in keyspace <br> use of any function in keyspace in <code>CREATE AGGREGATE</code></td></tr><tr><td><code>EXECUTE</code>    </td><td><code>FUNCTION</code>                   </td><td><code>SELECT</code>, <code>INSERT</code>, <code>UPDATE</code> using function <br> use of function in <code>CREATE AGGREGATE</code></td></tr></table><h3 id="grantPermissionsStmt">GRANT PERMISSION</h3><p><i>Syntax:</i> </p><pre class="syntax"><pre>&lt;grant-permission-stmt> ::= GRANT ( ALL ( PERMISSIONS )? | &lt;permission> ( PERMISSION )? ) ON &lt;resource> TO &lt;identifier>
+
+&lt;permission> ::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESRIBE | EXECUTE
+
+&lt;resource> ::= ALL KEYSPACES
+             | KEYSPACE &lt;identifier>
+             | ( TABLE )? &lt;tablename>
+             | ALL ROLES
+             | ROLE &lt;identifier>
+             | ALL FUNCTIONS ( IN KEYSPACE &lt;identifier> )?
+             | FUNCTION &lt;functionname>
+</pre></pre><p></p><p><i>Sample:</i> </p><pre class="sample"><pre>GRANT SELECT ON ALL KEYSPACES TO data_reader;
+</pre></pre><p>This gives any user with the role <code>data_reader</code> permission to execute <code>SELECT</code> statements on any table across all keyspaces</p><pre class="sample"><pre>GRANT MODIFY ON KEYSPACE keyspace1 TO data_writer;
+</pre></pre><p>This give any user with the role <code>data_writer</code> permission to perform <code>UPDATE</code>, <code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code> and <code>TRUNCATE</code> queries on all tables in the <code>keyspace1</code> keyspace</p><pre class="sample"><pre>GRANT DROP ON keyspace1.table1 TO schema_owner;
+</pre></pre><p>This gives any user with the <code>schema_owner</code> role permissions to <code>DROP</code> <code>keyspace1.table1</code>.</p><pre class="sample"><pre>GRANT EXECUTE ON FUNCTION keyspace1.user_function( int ) TO report_writer;
+</pre></pre><p>This grants any user with the <code>report_writer</code> role permission to execute <code>SELECT</code>, <code>INSERT</code> and <code>UPDATE</code> queries which use the function <code>keyspace1.user_function( int )</code></p><pre class="sample"><pre>GRANT DESCRIBE ON ALL ROLES TO role_admin;
+</pre></pre><p>This grants any user with the <code>role_admin</code> role permission to view any and all roles in the system with a <code>LIST ROLES</code> statement</p><h4 id="grantAll">GRANT ALL </h4><p>When the <code>GRANT ALL</code> form is used, the appropriate set of permissions is determined automatically based on the target resource.</p><h4 id="autoGrantPermissions">Automatic Granting</h4><p>When a resource is created, via a <code>CREATE KEYSPACE</code>, <code>CREATE TABLE</code>, <code>CREATE FUNCTION</code>, <code>CREATE AGGREGATE</code> or <code>CREATE ROLE</code> statement, the creator (the role the database user who issues the statement is identified as), is automatically granted all applicable permissions on the new resource.</p><h3 id="revokePermissionsStmt">REVOKE PERMISSION</h3><p><i>Syntax:</i> </p><pre class="syntax"><pre>&lt;revoke-permission-stmt> ::= REVOKE ( ALL ( PERMISSIONS )? | &lt;permission> ( PERMISSION )? ) ON &lt;resource> FROM &lt;identifier>
+
+&lt;permission> ::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESRIBE | EXECUTE
+
+&lt;resource> ::= ALL KEYSPACES
+             | KEYSPACE &lt;identifier>
+             | ( TABLE )? &lt;tablename>
+             | ALL ROLES
+             | ROLE &lt;identifier>
+             | ALL FUNCTIONS ( IN KEYSPACE &lt;identifier> )?
+             | FUNCTION &lt;functionname>
+</pre></pre><p></p><p><i>Sample:</i> </p><pre class="sample"><pre>REVOKE SELECT ON ALL KEYSPACES FROM data_reader;
+REVOKE MODIFY ON KEYSPACE keyspace1 FROM data_writer;
+REVOKE DROP ON keyspace1.table1 FROM schema_owner;
+REVOKE EXECUTE ON FUNCTION keyspace1.user_function( int ) FROM report_writer;
+REVOKE DESCRIBE ON ALL ROLES FROM role_admin;
+</pre></pre><p></p><h4 id="listPermissionsStmt">LIST PERMISSIONS</h4><p><i>Syntax:</i></p><pre class="syntax"><pre>&lt;list-permissions-stmt> ::= LIST ( ALL ( PERMISSIONS )? | &lt;permission> ) 
+                                 ( ON &lt;resource> )? 
+                                 ( OF &lt;identifier> ( NORECURSIVE )? )?
+
+&lt;resource> ::= ALL KEYSPACES
+             | KEYSPACE &lt;identifier>
+             | ( TABLE )? &lt;tablename>
+             | ALL ROLES
+             | ROLE &lt;identifier>
+             | ALL FUNCTIONS ( IN KEYSPACE &lt;identifier> )?
+             | FUNCTION &lt;functionname>
+</pre></pre><p></p><p><i>Sample:</i></p><pre class="sample"><pre>LIST ALL PERMISSIONS OF alice;
+</pre></pre><p>Show all permissions granted to <code>alice</code>, including those acquired transitively from any other roles. </p><pre class="sample"><pre>LIST ALL PERMISSIONS ON keyspace1.table1 OF bob;
+</pre></pre><p>Show all permissions on <code>keyspace1.table1</code> granted to <code>bob</code>, including those acquired transitively from any other roles. This also includes any permissions higher up the resource hierarchy which can be applied to <code>keyspace1.table1</code>. For example, should <code>bob</code> have <code>ALTER</code> permission on <code>keyspace1</code>, that would be included in the results of this query. Adding the <code>NORECURSIVE</code> switch restricts the results to only those permissions which were directly granted to <code>bob</code> or one of <code>bob</code>'s roles.</p><pre class="sample"><pre>LIST SELECT PERMISSIONS OF carlos;
+</pre></pre><p>Show any permissions granted to <code>carlos</code> or any of <code>carlos</code>'s roles, limited to <code>SELECT</code> permissions on any resource.</p><h2 id="types">Data Types</h2><p>CQL supports a rich set of data types for columns defined in a table, including collection types. On top of those native and collection types, users can also provide custom types (through a JAVA class extending <code>AbstractType</code> loadable by Cassandra). The syntax of types is thus:</p><pre class="syntax"><pre>&lt;type> ::= &lt;native-type>
          | &lt;collection-type>
          | &lt;tuple-type>
          | &lt;string>       // Used for custom types. The fully-qualified name of a JAVA class
@@ -463,6 +576,7 @@ UPDATE plays SET scores = scores - [ 12,
 </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><h4 id="dateOfandunixTimestampOf"><code>dateOf</code> and <code>unixTimestampOf</code></h4><p>The <code>dateOf</code> and <code>unixTimestampOf</code> functions take a <code>timeuuid</code> argument and extract the embedded timestamp. However, while the <code>dateof</code> function return it with the <code>timestamp</code> type (that most client, including cqlsh, interpret as a date), the <code>unixTimestampOf</code> function returns it as a <code>bigint</code> raw value.</p><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 every <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> argum
 ent 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 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
   RETURNS int
   LANGUAGE java
   AS $$ return arg; $$;
@@ -470,7 +584,8 @@ CREATE FUNCTION sample ( arg text ) ...;
 SELECT some_function(column) FROM atable ...;
 UPDATE atable SET col = some_function(?) ...;
 </pre></pre><p></p><pre class="sample"><pre>CREATE TYPE custom_type (txt text, i int);
-CREATE FUNCTION fct_using_udt ( udtarg frozen&lt;customType> )
+CREATE FUNCTION fct_using_udt ( udtarg frozen&lt;custom_type> )
+  RETURNS NULL ON NULL INPUT
   RETURNS text
   LANGUAGE java
   AS $$ return udtarg.getString("txt"); $$;
@@ -504,7 +619,7 @@ CREATE AGGREGATE average ( int )
   FINALFUNC averageFinal
   INITCOND (0, 0);
 
-CREATE TYPE atable (
+CREATE TABLE atable (
   pk int PRIMARY KEY,
   val int);
 INSERT INTO atable (pk, val) VALUES (1,1);
@@ -513,4 +628,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>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>uuid</code>     </td><td>string                </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()</code> 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 the
 y 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>ALTER</code>        </td><td>yes </td></tr><tr><td><code>AND</code>          </td><td>yes </td></tr><tr><td><code>ANY</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  </t
 d></tr><tr><td><code>BY</code>           </td><td>yes </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>CONSISTENCY</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>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>DETERMINISTIC</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>EACH_QUORUM</code>  </td><td>yes </td></tr><tr><td><code>FUNCTION</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>GRANT</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>CUSTOM</code>       </td><td>no  </td></tr><tr><td><code>INITCOND</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>KEY</code>          </td><td>no  </td></tr><tr><td><code>KEYSPACE</code>     </td><td>yes </td></tr><tr><td><code>LANGUAGE</code>     </td><td>no  </td></tr><tr><td><code>LEVEL</code>        </td><td>no  </td></tr><tr><td><code>LIMIT</code>        </td><td>yes </td></tr><tr><td><code>LOCAL_ONE</code>    </td><td>yes </td></tr><tr><td><code>LOCAL_QUORUM</code> </td><td>yes </td></tr><tr><td><code>MODIFY</code>       </td><td>yes <
 /td></tr><tr><td><code>NORECURSIVE</code>  </td><td>yes </td></tr><tr><td><code>NON</code>          </td><td>no  </td></tr><tr><td><code>NOSUPERUSER</code>  </td><td>no  </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>ONE</code>          </td><td>yes </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>QUORUM</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>SCHEMA</code>       </td><td>yes </td></tr><tr><td><code>SELEC
 T</code>       </td><td>yes </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>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>TIMESTAMP</code>    </td><td>no  </td></tr><tr><td><code>TIMEUUID</code>     </td><td>no  </td></tr><tr><td><code>THREE</code>        </td><td>yes </td></tr><tr><td><code>TOKEN</code>        </td><td>yes </td></tr><tr><td><code>TRUNCATE</code>     </td><td>yes </td></tr><tr><td><code>TTL</code>          </td><td>no  </td></tr><tr><td><code>TWO</code>          </td><td>yes </td></tr><tr><td><code>TYPE</code>         </td><td>no  </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><tr><td><code>DISTINCT</code>     </td><td>no  </td></tr><tr><td><code>DATE</code>         </td><td>no  </td></tr><tr><td><code>TIME</code>         </td><td>no  </td></tr></table><h2 id="appendixB">Appendix B: CQL Reserved Types</h2><p>The following type names are not currently 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>byte</code>      </td></tr><tr><td><code>smallint</code>  </td></tr><tr><td><code>complex</code>   </td></tr><tr><td><code>enum</code>      </td></tr><tr><td><code>date</code>      </td></tr><tr><td><code>interval</code>  </td></tr><tr><td><code>macaddr</code>   </td></tr><tr><td><code>bitstring</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></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 keyspace</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="#select
 Where">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 CUSTOM 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 <code>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> o
 ption 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> statements 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>maxTimeuuid</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 expo
 nent 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, functionality is introduced.</td></tr><tr><td>Patch     </td><td>The patch version is incremented when bugs are fixed.</td></tr></table></body></html>

[... 3 lines stripped ...]