cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Fix validation when adding static columns
Date Mon, 11 Aug 2014 15:59:28 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 2692c29bb -> 73b02d67c


Fix validation when adding static columns

patch by slebresne; reviewed by iamaleksey for CASSANDRA-7730


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/73b02d67
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/73b02d67
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/73b02d67

Branch: refs/heads/cassandra-2.0
Commit: 73b02d67c1fcea9a2f773251a0a525ec51b7477a
Parents: 2692c29
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Mon Aug 11 17:44:14 2014 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Mon Aug 11 17:45:21 2014 +0200

----------------------------------------------------------------------
 CHANGES.txt                                                 | 1 +
 .../cassandra/cql3/statements/AlterTableStatement.java      | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/73b02d67/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d6976db..4a3e086 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.10
+ * Fix validation when adding static columns (CASSANDRA-7730)
  * (Thrift) fix range deletion of supercolumns (CASSANDRA-7733)
  * Fix potential AssertionError in RangeTombstoneList (CASSANDRA-7700)
  * Validate arguments of blobAs* functions (CASSANDRA-7707)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/73b02d67/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java b/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
index 85b3547..88f0de8 100644
--- a/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java
@@ -89,8 +89,13 @@ public class AlterTableStatement extends SchemaAlteringStatement
                 if (cfDef.isCompact)
                     throw new InvalidRequestException("Cannot add new column to a COMPACT
STORAGE table");
 
-                if (isStatic && !cfDef.isComposite)
-                    throw new InvalidRequestException("Static columns are not allowed in
COMPACT STORAGE tables");
+                if (isStatic)
+                {
+                    if (!cfDef.isComposite)
+                        throw new InvalidRequestException("Static columns are not allowed
in COMPACT STORAGE tables");
+                    if (cfDef.clusteringColumns().isEmpty())
+                        throw new InvalidRequestException("Static columns are only useful
(and thus allowed) if the table has at least one clustering column");
+                }
 
                 if (name != null)
                 {


Mime
View raw message