You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2013/08/21 12:16:45 UTC
[1/4] git commit: CQL3 documentation fixes (#5878)
Updated Branches:
refs/heads/trunk 1bb1ffbc0 -> 896e1722d
CQL3 documentation fixes (#5878)
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/55fed339
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/55fed339
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/55fed339
Branch: refs/heads/trunk
Commit: 55fed339cb4243634b062927cb060044aba32b59
Parents: 08d22df
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Aug 21 12:15:14 2013 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Aug 21 12:15:14 2013 +0200
----------------------------------------------------------------------
doc/cql3/CQL.textile | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/55fed339/doc/cql3/CQL.textile
----------------------------------------------------------------------
diff --git a/doc/cql3/CQL.textile b/doc/cql3/CQL.textile
index 22248ef..bb9a632 100644
--- a/doc/cql3/CQL.textile
+++ b/doc/cql3/CQL.textile
@@ -468,8 +468,10 @@ bc(syntax)..
| <identifier> '=' <identifier> '+' <map-literal>
| <identifier> '[' <term> ']' '=' <term>
-<where-clause> ::= <identifier> '=' <term>
- | <identifier> IN '(' ( <term> ( ',' <term> )* )? ')'
+<where-clause> ::= <relation> ( AND <relation> )*
+
+<relation> ::= <identifier> '=' <term>
+ | <identifier> IN '(' ( <term> ( ',' <term> )* )? ')'
<option> ::= TIMESTAMP <integer>
| TTL <integer>
@@ -485,7 +487,7 @@ WHERE movie = 'Serenity';
UPDATE UserActions SET total = total + 2 WHERE user = B70DE1D0-9908-4AE3-BE34-5573E5B09F14 AND action = 'click';
p.
-The @UPDATE@ statement writes one or more columns for a given row in a table. The @<where-clause>@ is used to select the row to update and must include all columns composing the @PRIMARY KEY@. Other columns values are specified through @<assignment>@ after the @SET@ keyword.
+The @UPDATE@ statement writes one or more columns for a given row in a table. The @<where-clause>@ is used to select the row to update and must include all columns composing the @PRIMARY KEY@ (the @IN@ relation is only supported for the last column of the partition key). Other columns values are specified through @<assignment>@ after the @SET@ keyword.
Note that unlike in SQL, @UPDATE@ does not check the prior existence of the row: the row is created if none existed before, and updated otherwise. Furthermore, there is no mean to know which of creation or update happened. In fact, the semantic of @INSERT@ and @UPDATE@ are identical.
@@ -514,8 +516,10 @@ bc(syntax)..
<selection> ::= <identifier> ( '[' <term> ']' )?
-<where-clause> ::= <identifier> '=' <term>
- | <identifier> IN '(' ( <term> ( ',' <term> )* )? ')'
+<where-clause> ::= <relation> ( AND <relation> )*
+
+<relation> ::= <identifier> '=' <term>
+ | <identifier> IN '(' ( <term> ( ',' <term> )* )? ')'
p.
__Sample:__
@@ -524,7 +528,7 @@ DELETE FROM NerdMovies USING TIMESTAMP 1240003134 WHERE movie = 'Serenity';
DELETE phone FROM Users WHERE userid IN (C73DE1D3-AF08-40F3-B124-3FF3E5109F22, B70DE1D0-9908-4AE3-BE34-5573E5B09F14);
p.
-The @DELETE@ statement deletes columns and rows. If column names are provided directly after the @DELETE@ keyword, only those columns are deleted from the row indicated by the @<where-clause>@ (the @id[value]@ syntax in @<selection>@ is for collection, please refer to the "collection section":#collections for more details). Otherwise whole rows are removed. The @<where-clause>@ allows to specify the key for the row(s) to delete.
+The @DELETE@ statement deletes columns and rows. If column names are provided directly after the @DELETE@ keyword, only those columns are deleted from the row indicated by the @<where-clause>@ (the @id[value]@ syntax in @<selection>@ is for collection, please refer to the "collection section":#collections for more details). Otherwise whole rows are removed. The @<where-clause>@ allows to specify the key for the row(s) to delete (the @IN@ relation is only supported for the last column of the partition key).
@DELETE@ supports the @TIMESTAMP@ options with the same semantic that in the "@UPDATE@":#updateStmt statement.
@@ -594,11 +598,11 @@ bc(syntax)..
| TTL '(' <identifier> ')'
| <function> '(' (<selector> (',' <selector>)*)? ')'
-<where-clause> ::= <relation> ( "AND" <relation> )*
+<where-clause> ::= <relation> ( AND <relation> )*
-<relation> ::= <identifier> ("=" | "<" | ">" | "<=" | ">=") <term>
+<relation> ::= <identifier> ('=' | '<' | '>' | '<=' | '>=') <term>
| <identifier> IN '(' ( <term> ( ',' <term>)* )? ')'
- | TOKEN '(' <identifier> ')' ("=" | "<" | ">" | "<=" | ">=") (<term> | TOKEN '( <term> ')' )
+ | TOKEN '(' <identifier> ')' ('=' | '<' | '>' | '<=' | '>=') (<term> | TOKEN '(' <term> ')' )
<order-by> ::= <ordering> ( ',' <odering> )*
<ordering> ::= <identifer> ( ASC | DESC )?
@@ -659,6 +663,8 @@ When specifying relations, the @TOKEN@ function can be used on the @PARTITION KE
bc(sample).
SELECT * FROM posts WHERE token(userid) > token('tom') AND token(userid) < token('bob')
+Moreover, the @IN@ relation is only allowed on the last column of the partition key and on the last column of the full primary key.
+
h4(#selectOrderBy). @<order-by>@
The @ORDER BY@ 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 (@ASC@ for ascendant and @DESC@ for descendant, omitting the order being equivalent to @ASC@). Currently the possible orderings are limited (which depends on the table "@CLUSTERING ORDER@":#createTableOptions):
[4/4] git commit: Merge branch 'cassandra-2.0' into trunk
Posted by sl...@apache.org.
Merge branch 'cassandra-2.0' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/896e1722
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/896e1722
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/896e1722
Branch: refs/heads/trunk
Commit: 896e1722da7076105ec1b533c25940616b2bd3b3
Parents: 1bb1ffb c4f6be8
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Aug 21 12:16:37 2013 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Aug 21 12:16:37 2013 +0200
----------------------------------------------------------------------
doc/cql3/CQL.textile | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[2/4] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0.0
Posted by sl...@apache.org.
Merge branch 'cassandra-1.2' into cassandra-2.0.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/cd471824
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cd471824
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cd471824
Branch: refs/heads/trunk
Commit: cd47182458623fb7b0c5b447a5f8a5eff33beac9
Parents: 7a300c2 55fed33
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Aug 21 12:15:59 2013 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Aug 21 12:15:59 2013 +0200
----------------------------------------------------------------------
doc/cql3/CQL.textile | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/cd471824/doc/cql3/CQL.textile
----------------------------------------------------------------------
diff --cc doc/cql3/CQL.textile
index ba90994,bb9a632..c87b9a5
--- a/doc/cql3/CQL.textile
+++ b/doc/cql3/CQL.textile
@@@ -500,11 -487,9 +502,11 @@@ WHERE movie = 'Serenity'
UPDATE UserActions SET total = total + 2 WHERE user = B70DE1D0-9908-4AE3-BE34-5573E5B09F14 AND action = 'click';
p.
- The @UPDATE@ statement writes one or more columns for a given row in a table. The @<where-clause>@ is used to select the row to update and must include all columns composing the @PRIMARY KEY@. Other columns values are specified through @<assignment>@ after the @SET@ keyword.
+ The @UPDATE@ statement writes one or more columns for a given row in a table. The @<where-clause>@ is used to select the row to update and must include all columns composing the @PRIMARY KEY@ (the @IN@ relation is only supported for the last column of the partition key). Other columns values are specified through @<assignment>@ after the @SET@ keyword.
-Note that unlike in SQL, @UPDATE@ does not check the prior existence of the row: the row is created if none existed before, and updated otherwise. Furthermore, there is no mean to know which of creation or update happened. In fact, the semantic of @INSERT@ and @UPDATE@ are identical.
+Note that unlike in SQL, @UPDATE@ does not check the prior existence of the row by default: the row is created if none existed before, and updated otherwise. Furthermore, there is no mean to know which of creation or update happened.
+
+It is however possible to use the conditions on some columns through @IF@, in which case the row will not be updated unless such condition are met. But please note that using @IF@ conditions will incur a non negligible performance cost (internally, Paxos will be used) so this should be used sparingly.
In an @UPDATE@ statement, all updates within the same partition key are applied atomically and in isolation.
[3/4] git commit: Merge branch 'cassandra-2.0.0' into cassandra-2.0
Posted by sl...@apache.org.
Merge branch 'cassandra-2.0.0' into cassandra-2.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c4f6be8c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c4f6be8c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c4f6be8c
Branch: refs/heads/trunk
Commit: c4f6be8c47cb1ea343f5bf2b14cf1173e57c8bcc
Parents: 2e0279f cd47182
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Aug 21 12:16:23 2013 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Aug 21 12:16:23 2013 +0200
----------------------------------------------------------------------
doc/cql3/CQL.textile | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------