Updated Branches: refs/heads/cassandra-1.2.0 eb738b020 -> 715c836d4
Merge branch 'cassandra-1.1' into cassandra-1.2.0 Conflicts: src/java/org/apache/cassandra/cql3/statements/SelectStatement.java Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/715c836d Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/715c836d Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/715c836d Branch: refs/heads/cassandra-1.2.0 Commit: 715c836d45bd8a3d4cbedb56c288a61f9347ab87 Parents: eb738b0 cb7a231 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Mon Nov 26 16:40:35 2012 +0100 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Mon Nov 26 16:40:35 2012 +0100 ---------------------------------------------------------------------- .../cassandra/cql3/statements/SelectStatement.java | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/715c836d/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cql3/statements/SelectStatement.java index 0a0dcfd,967d18f..7d5bd15 --- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java @@@ -1190,13 -1115,14 +1190,16 @@@ public class SelectStatement implement if (!stmt.parameters.orderings.isEmpty()) { + if (!stmt.metadataRestrictions.isEmpty()) + throw new InvalidRequestException("ORDER BY with 2ndary indexes is not supported."); + - if (stmt.isKeyRange()) + if (stmt.isKeyRange) throw new InvalidRequestException("ORDER BY is only supported when the partition key is restricted by an EQ or an IN."); - // check if we are trying to order by column that wouldn't be included in the results - if (!stmt.selectedNames.isEmpty()) // empty means wildcard was used + // If we order an IN query, we'll have to do a manual sort post-query. Currently, this sorting requires that we + // have queried the column on which we sort (TODO: we should update it to add the column on which we sort to the one + // queried automatically, and then removing it from the resultSet afterwards if needed) + if (stmt.keyIsInRelation && !stmt.selectedNames.isEmpty()) // empty means wildcard was used { for (ColumnIdentifier column : stmt.parameters.orderings.keySet()) {