cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [1/2] git commit: IN on the last clustering columns + ORDER BY DESC yield no results
Date Fri, 14 Feb 2014 12:48:54 GMT
Updated Branches:
  refs/heads/cassandra-2.0 78df8a33c -> 44f9c8689


IN on the last clustering columns + ORDER BY DESC yield no results

patch by slebresne; reviewed by thobbs for CASSANDRA-6701


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

Branch: refs/heads/cassandra-2.0
Commit: c9ade9dc67f1193c1c417a8709b6e0f85568fc68
Parents: de72e7f
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Fri Feb 14 13:42:27 2014 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Fri Feb 14 13:42:27 2014 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                   | 1 +
 .../org/apache/cassandra/cql3/statements/SelectStatement.java | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9ade9dc/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 872934a..492cc2d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,7 @@
  * Log USING TTL/TIMESTAMP in a counter update warning (CASSANDRA-6649)
  * Don't exchange schema between nodes with different versions (CASSANDRA-6695)
  * Use real node messaging versions for schema exchange decisions (CASSANDRA-6700)
+ * IN on the last clustering columns + ORDER BY DESC yield no results (CASSANDRA-6701)
 
 
 1.2.15

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c9ade9dc/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 001c77a..e058cff 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -22,6 +22,7 @@ import java.util.*;
 import java.util.concurrent.ExecutionException;
 
 import com.google.common.collect.AbstractIterator;
+import com.google.common.collect.Lists;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.github.jamm.MemoryMeter;
@@ -625,7 +626,7 @@ public class SelectStatement implements CQLStatement, MeasurableForPreparedCache
                             throw new InvalidRequestException(String.format("Invalid null
clustering key part %s", name));
                         ColumnNameBuilder copy = builder.copy().add(val);
                         // See below for why this
-                        s.add((bound == Bound.END && copy.remainingCount() > 0)
? copy.buildAsEndOfRange() : copy.build());
+                        s.add((b == Bound.END && copy.remainingCount() > 0) ?
copy.buildAsEndOfRange() : copy.build());
                     }
                     return new ArrayList<ByteBuffer>(s);
                 }
@@ -727,7 +728,9 @@ public class SelectStatement implements CQLStatement, MeasurableForPreparedCache
             {
                 return new AbstractIterator<IColumn>()
                 {
-                    Iterator<ByteBuffer> iter = requested.iterator();
+                    // If the query is reversed, we'll reverse everything in the end, so
return the
+                    // requested in reversed order so we do return values in requested order
in the end
+                    Iterator<ByteBuffer> iter = (isReversed ? Lists.reverse(requested)
: requested).iterator();
                     public IColumn computeNext()
                     {
                         while (iter.hasNext())


Mime
View raw message