cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Less strict validation after #4004
Date Thu, 03 May 2012 07:59:21 GMT
Updated Branches:
  refs/heads/cassandra-1.1 6d3888143 -> a75b708de


Less strict validation after #4004


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

Branch: refs/heads/cassandra-1.1
Commit: a75b708decc25372949f3c764e4f500735fdd452
Parents: 6d38881
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Thu May 3 09:58:27 2012 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Thu May 3 09:58:27 2012 +0200

----------------------------------------------------------------------
 .../cassandra/cql3/statements/SelectStatement.java |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a75b708d/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 561db9a..b9d1c4f 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -960,7 +960,7 @@ public class SelectStatement implements CQLStatement
 
             if (!stmt.parameters.orderings.isEmpty())
             {
-                boolean[] reversedMap = new boolean[cfDef.columns.size()];
+                Boolean[] reversedMap = new Boolean[cfDef.columns.size()];
                 int i = 0;
                 for (Map.Entry<ColumnIdentifier, Boolean> entry : stmt.parameters.orderings.entrySet())
                 {
@@ -977,14 +977,17 @@ public class SelectStatement implements CQLStatement
                     if (i++ != name.position)
                         throw new InvalidRequestException(String.format("Order by currently
only support the ordering of columns following their declared order in the PRIMARY KEY"));
 
-                    if (reversed != isReversedType(name))
-                        reversedMap[name.position] = true;
+                    reversedMap[name.position] = (reversed != isReversedType(name));
                 }
 
-                // Check that all boolean in reversedMap agrees
+                // Check that all boolean in reversedMap, if set, agrees
                 Boolean isReversed = null;
-                for (boolean b : reversedMap)
+                for (Boolean b : reversedMap)
                 {
+                    // Column on which order is specified can be in any order
+                    if (b == null)
+                        continue;
+
                     if (isReversed == null)
                     {
                         isReversed = b;
@@ -993,6 +996,7 @@ public class SelectStatement implements CQLStatement
                     if (isReversed != b)
                         throw new InvalidRequestException(String.format("Unsupported order
by relation"));
                 }
+                assert isReversed != null;
                 stmt.isReversed = isReversed;
             }
 


Mime
View raw message