Repository: cassandra Updated Branches: refs/heads/cassandra-2.1 d4ac8d59b -> 92325cc12
Throw IRE for relations on entire collections Patch by Tyler Hobbs; review by Sylvain Lebresne for CASSANDRA-7506 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/296903bd Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/296903bd Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/296903bd Branch: refs/heads/cassandra-2.1 Commit: 296903bd3c75cf35a4e0ec8cfc1a02e805c87f2f Parents: 7554eb5 Author: Tyler Hobbs <ty...@datastax.com> Authored: Tue Aug 19 11:13:54 2014 -0500 Committer: Tyler Hobbs <ty...@datastax.com> Committed: Tue Aug 19 11:13:54 2014 -0500 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ .../org/apache/cassandra/cql3/statements/SelectStatement.java | 7 +++++++ 2 files changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/296903bd/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 0ac1fb6..de45376 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,6 @@ 2.0.10 + * Throw InvalidRequestException when queries contain relations on entire + collection columns (CASSANDRA-7506) * Fix PRSI handling of CQL3 row markers for row cleanup (CASSANDRA-7787) * (cqlsh) enable CTRL-R history search with libedit (CASSANDRA-7577) * Fix dropping collection when it's the last regular column (CASSANDRA-7744) http://git-wip-us.apache.org/repos/asf/cassandra/blob/296903bd/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java index 523302f..8145722 100644 --- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java @@ -1658,6 +1658,13 @@ public class SelectStatement implements CQLStatement, MeasurableForPreparedCache StorageService.getPartitioner().getTokenValidator()); } + // We don't support relations against entire collections, like "numbers = {1, 2, 3}" + if (receiver.type.isCollection()) + { + throw new InvalidRequestException(String.format("Collection column '%s' (%s) cannot be restricted by a '%s' relation", + name, receiver.type.asCQL3Type(), newRel.operator())); + } + switch (newRel.operator()) { case EQ: