cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [2/2] git commit: Backport 4645 to 1.1
Date Mon, 26 Nov 2012 18:39:54 GMT
Backport 4645 to 1.1


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

Branch: refs/heads/cassandra-1.2.0
Commit: 763305b49e98756c3b85cad02cf68c36f5059994
Parents: cb7a231
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Mon Nov 26 19:38:49 2012 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Mon Nov 26 19:38:49 2012 +0100

----------------------------------------------------------------------
 .../cassandra/cql3/statements/SelectStatement.java |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/763305b4/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 967d18f..d162a01 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -1045,6 +1045,8 @@ public class SelectStatement implements CQLStatement
                 }
             }
 
+            boolean keyIsInRelation = stmt.keyRestriction != null && stmt.keyRestriction.isEquality()
&& stmt.keyRestriction.eqValues.size() > 1;
+
             /*
              * At this point, the select statement if fully constructed, but we still have
a few things to validate
              */
@@ -1121,8 +1123,10 @@ public class SelectStatement implements CQLStatement
                 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 (keyIsInRelation && !stmt.selectedNames.isEmpty()) // empty means
wildcard was used
                 {
                     for (ColumnIdentifier column : stmt.parameters.orderings.keySet())
                     {


Mime
View raw message