cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ble...@apache.org
Subject cassandra git commit: Rejects partition range deletions when columns are specified
Date Tue, 01 Dec 2015 17:12:56 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 2af4fba7e -> 3864b2114


Rejects partition range deletions when columns are specified

patch by Benjamin Lerer; reviewed by Carl Yeksigian for CASSANDRA-10739


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

Branch: refs/heads/cassandra-3.0
Commit: 3864b2114ab11a02cf55e91c1e5553c9c4f854bc
Parents: 2af4fba
Author: Benjamin Lerer <b.lerer@gmail.com>
Authored: Tue Dec 1 18:10:11 2015 +0100
Committer: Benjamin Lerer <b.lerer@gmail.com>
Committed: Tue Dec 1 18:12:46 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                  | 1 +
 .../apache/cassandra/cql3/statements/DeleteStatement.java    | 6 ++++++
 .../cassandra/cql3/validation/operations/DeleteTest.java     | 8 ++++++++
 3 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3864b211/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index bd14e67..7fffbbf 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.1
+ * Rejects partition range deletions when columns are specified (CASSANDRA-10739)
  * Fix error when saving cached key for old format sstable (CASSANDRA-10778)
  * Invalidate prepared statements on DROP INDEX (CASSANDRA-10758)
  * Fix SELECT statement with IN restrictions on partition key,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3864b211/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java b/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
index 0efe35c..daeecfe 100644
--- a/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
@@ -78,6 +78,12 @@ public class DeleteStatement extends ModificationStatement
         {
             if (!regularDeletions.isEmpty())
             {
+                // if the clustering size is zero but there are some clustering columns,
it means that it's a
+                // range deletion (the full partition) in which case we need to throw an
error as range deletion
+                // do not support specific columns
+                checkFalse(clustering.size() == 0 && cfm.clusteringColumns().size()
!= 0,
+                           "Range deletions are not supported for specific columns");
+
                 params.newRow(clustering);
 
                 for (Operation op : regularDeletions)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3864b211/test/unit/org/apache/cassandra/cql3/validation/operations/DeleteTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/DeleteTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/DeleteTest.java
index 5d9ef8f..4f35afa 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/DeleteTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/DeleteTest.java
@@ -718,6 +718,8 @@ public class DeleteTest extends CQLTester
             // Test invalid queries
             assertInvalidMessage("Range deletions are not supported for specific columns",
                                  "DELETE value FROM %s WHERE partitionKey = ? AND clustering
>= ?", 2, 1);
+            assertInvalidMessage("Range deletions are not supported for specific columns",
+                                 "DELETE value FROM %s WHERE partitionKey = ?", 2);
         }
     }
 
@@ -911,6 +913,12 @@ public class DeleteTest extends CQLTester
             // Test invalid queries
             assertInvalidMessage("Range deletions are not supported for specific columns",
                                  "DELETE value FROM %s WHERE partitionKey = ? AND (clustering_1,
clustering_2) >= (?, ?)", 2, 3, 1);
+            assertInvalidMessage("Range deletions are not supported for specific columns",
+                                 "DELETE value FROM %s WHERE partitionKey = ? AND clustering_1
>= ?", 2, 3);
+            assertInvalidMessage("Range deletions are not supported for specific columns",
+                                 "DELETE value FROM %s WHERE partitionKey = ? AND clustering_1
= ?", 2, 3);
+            assertInvalidMessage("Range deletions are not supported for specific columns",
+                                 "DELETE value FROM %s WHERE partitionKey = ?", 2);
         }
     }
 


Mime
View raw message