From 33b68fde0b7f915802c1040242f7e70e56e2745a Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Fri, 28 Oct 2011 15:59:57 +0000 Subject: [PATCH] revert unintended commit of CQL doc changes git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0@1190414 13f79535-47bb-0310-9956-ffa450edef68 --- doc/cql/CQL.textile | 702 +++++++++++++------------------------------- 1 file changed, 203 insertions(+), 499 deletions(-) diff --git a/doc/cql/CQL.textile b/doc/cql/CQL.textile index 435c83a924..9b90edc996 100644 --- a/doc/cql/CQL.textile +++ b/doc/cql/CQL.textile @@ -1,549 +1,305 @@ -==== - h1. Cassandra Query Language (CQL) v2.0 h2. Table of Contents {toc} -h2. Syntax conventions - -To aid in specifying the CQL syntax, we will use the following conventions in this document: - -* Language rules will be given in a BNF(Backus-Naur Form)-like notation, looking like this: - -bc(syntax). - ::= * - ; - -* Nonterminal symbols in syntax rules will have @@. -* Terminal symbols will be shown in @"single quotes"@. -* As an additional shortcut notation to BNF, optional symbols (that can occur zero or one times) will be followed by a @?@ marker. Optional symbols that can occur zero or any number of times will be followed by a @*@ marker. Multiple symbols may be grouped together in @(parentheses)@ to signify that they are all optional or repeatable together. -* In a few cases where meaning is more easily conveyed through prose, we explain a symbol and its expansion without BNF. -* Sample code will also be shown in a code block: - -bc(sample). -SELECT sample_usage FROM cql; - -* References to keywords or pieces of CQL code in running text will be shown in a @fixed-width font@. - -h2. Overall syntax - -CQL consists of statements. As in SQL, some statements directly make changes to data, some look up data, and some change the way data is stored. - -All statements end with a semicolon. - -bc(syntax). - ::= ";" - ; - ::= - | - | - | - ; - ::= - | - | - | - | - ; - ::= - | - | - | - | - | - | - ; - -String literals and identifiers (including keyspace and column family names) are case-sensitive, but CQL keywords are not. We show CQL keywords in this document in @UPPERCASE@ merely as a convention to aid readability. - -Literal values can be expressed in several ways in CQL. - -bc(syntax). - ::= "KEY" - | - | - | - | - | - ; - -* An @@ is a letter followed by any sequence of letters, digits, or the underscore (@_@). -* A @@ is encased in @'single quotes'@. A single quote itself can be represented in a string literal by doubling it, as in SQL: @'Single quote -> '' <-'@. -* An @@ consists of an optional minus sign (@-@) followed by one or more digits (@0-9@). -* A @@ can be expressed in the canonical UUID form: 32 hex digits (@0-9@ or @a-f@, case insensitive), separated by dashes (@-@) after the 8th, 12th, 16th, and 20th digits. Example: @01234567-0123-0123-0123-0123456789ab@ -* A @@ is a series of one or more decimal digits, followed by a period (@.@), and one or more decimal digits following. Note that there is no provision for "e" notation, no optional @+@ sign, and the forms @.42@ and @42.@ are not accepted. Use @0.42@ and @42.0@. -* Whitespace is not significant except to separate terms, and inside string literals. - -Comments in CQL can begin with a double dash (@--@) or a double slash (@//@) and extend to the end of the line. Multiline comments are enclosed in @/* ... */@. - -h2(#storageTypes). Data Storage Types - -__Syntax:__ - -bc(syntax). - ::= "ascii" - | "bigint" - | "blob" - | "boolean" - | "counter" - | "decimal" - | "double" - | "float" - | "int" - | "text" - | "timestamp" - | "uuid" - | "varchar" - | "varint" - ; - -The following table gives additional information on the available data types. - -|_. type|_. description| -|ascii|ASCII character string| -|bigint|64-bit signed long| -|blob|Arbitrary bytes (no validation)| -|boolean|true or false| -|counter|Counter column (64-bit long)| -|decimal|Variable-precision decimal| -|double|64-bit IEEE-754 floating point| -|float|32-bit IEEE-754 floating point| -|int|32-bit signed int| -|text|UTF8 encoded string| -|timestamp|A timestamp. See "Working with dates":#usingdates below for more information.| -|uuid|Type 1 or type 4 UUID| -|varchar|UTF8 encoded string| -|varint|Arbitrary-precision integer| - -_Note: In addition to the recognized types listed above, it is also possible to supply a string containing the name of a class (a sub-class of @AbstractType@ loadable by Cassandra). The class name should either be fully qualified, or relative to the @org.apache.cassandra.db.marshal@ package._ - -h3(#usingdates). Working with dates - -Values serialized with the @timestamp@ type are encoded as 64-bit signed integers representing a number of milliseconds since the standard base time known as "the epoch": January 1 1970 at 00:00:00 GMT. - -Timestamp types can be input in CQL as simple long integers, giving the number of milliseconds since the epoch, as defined above. - -Timestamp types can also be input as string literals in any of the following ISO 8601 formats, each representing the time and date Jan 2, 2003, at 04:05:00 AM, GMT.: - -* @2011-02-03 04:05+0000@ -* @2011-02-03 04:05:00+0000@ -* @2011-02-03T04:05+0000@ -* @2011-02-03T04:05:00+0000@ - -The @+0000@ above is an RFC 822 4-digit time zone specification; @+0000@ refers to GMT. US Pacific Standard Time is @-0800@. The time zone may be omitted if desired-- the date will be interpreted as being in the time zone under which the coordinating Cassandra node is configured. - -* @2011-02-03 04:05@ -* @2011-02-03 04:05:00@ -* @2011-02-03T04:05@ -* @2011-02-03T04:05:00@ - -There are clear difficulties inherent in relying on the time zone configuration being as expected, though, so it is recommended that the time zone always be specified for timestamps when feasible. - -The time of day may also be omitted, if the date is the only piece that matters: - -* @2011-02-03@ -* @2011-02-03+0000@ - -In that case, the time of day will default to 00:00:00, in the specified or default time zone. - h2. USE -__Syntax:__ +__Synopsis:__ -bc(syntax). - ::= "USE" - ; +bc. +USE ; -__Sample:__ - -bc(sample). -USE myApp; - -A @USE@ statement consists of the @USE@ keyword, followed by a valid keyspace name. Its purpose is to assign the per-connection, current working keyspace. All subsequent keyspace-specific actions will be performed in the context of the keyspace selected, unless otherwise specified, until another USE statement is issued or the connection terminates. +A @USE@ statement consists of the @USE@ keyword, followed by a valid keyspace name. Its purpose is to assign the per-connection, current working keyspace. All subsequent keyspace-specific actions will be performed in the context of the supplied value. h2. SELECT -__Syntax:__ +__Synopsis:__ -bc(syntax). - ::= "SELECT" - "FROM" ( "." )? - ( "USING" "CONSISTENCY" )? - ( "WHERE" )? - ( "LIMIT" )? - ; - ::= ( "," )* - | ("FIRST" )? "REVERSED"? - | "COUNT" "(" ")" - ; - ::= ".." - | "*" - ; - ::= "*" - | "1" - ; - ::= - | - | - ; - ::= ( "AND" )* - | "IN" "(" ( "," )* ")" - ; - ::= - ; - ::= "=" | "<" | ">" | "<=" | ">=" - ; - -__Sample:__ - -bc(sample). -SELECT Name, Occupation FROM People WHERE key IN (199, 200, 207); -SELECT FIRST 3 REVERSED 'time199'..'time100' FROM Events; -SELECT COUNT(*) FROM system.Migrations; +bc. +SELECT [FIRST N] [REVERSED]