Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 62064189E8 for ; Tue, 1 Dec 2015 17:12:56 +0000 (UTC) Received: (qmail 89799 invoked by uid 500); 1 Dec 2015 17:12:56 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 89766 invoked by uid 500); 1 Dec 2015 17:12:56 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 89755 invoked by uid 99); 1 Dec 2015 17:12:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Dec 2015 17:12:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 15E75E0498; Tue, 1 Dec 2015 17:12:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: blerer@apache.org To: commits@cassandra.apache.org Message-Id: <36771fbd60d5425db2d3b75cde9d83e1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cassandra git commit: Rejects partition range deletions when columns are specified Date: Tue, 1 Dec 2015 17:12:56 +0000 (UTC) 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 Authored: Tue Dec 1 18:10:11 2015 +0100 Committer: Benjamin Lerer 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); } }