You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2012/05/02 17:47:47 UTC

git commit: Fix cql3 order by for reversed queries

Updated Branches:
  refs/heads/cassandra-1.1 9efe99d92 -> 1686a36ed


Fix cql3 order by for reversed queries

patch by slebresene; reviewed by jbellis for CASSANDRA-4160


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

Branch: refs/heads/cassandra-1.1
Commit: 1686a36ed54686584bc4d11a9ca8eb2c733f870a
Parents: 9efe99d
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed May 2 17:47:03 2012 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed May 2 17:47:03 2012 +0200

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


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1686a36e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 49719f4..62234b2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -22,6 +22,7 @@
  * Expose repairing by a user provided range (CASSANDRA-3912)
  * Add way to force the cassandra-cli to refresh it's schema (CASSANDRA-4052)
  * Avoids having replicate on write tasks stacking up at CL.ONE (CASSANDRA-2889)
+ * (cql) Fix order by for reversed queries (CASSANDRA-4160)
 Merged from 1.0:
  * Fix super columns bug where cache is not updated (CASSANDRA-4190)
  * fix maxTimestamp to include row tombstones (CASSANDRA-4116)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1686a36e/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 b7c12dd..03c2a16 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -194,8 +194,8 @@ public class SelectStatement implements CQLStatement
         // ...a range (slice) of column names
         if (isColumnRange())
         {
-            ByteBuffer start = getRequestedBound(Bound.START, variables);
-            ByteBuffer finish = getRequestedBound(Bound.END, variables);
+            ByteBuffer start = getRequestedBound(parameters.isColumnsReversed ? Bound.END : Bound.START, variables);
+            ByteBuffer finish = getRequestedBound(parameters.isColumnsReversed ? Bound.START : Bound.END, variables);
 
             // Note that we use the total limit for every key. This is
             // potentially inefficient, but then again, IN + LIMIT is not a
@@ -309,8 +309,8 @@ public class SelectStatement implements CQLStatement
         if (isColumnRange())
         {
             SliceRange sliceRange = new SliceRange();
-            sliceRange.start = getRequestedBound(Bound.START, variables);
-            sliceRange.finish = getRequestedBound(Bound.END, variables);
+            sliceRange.start = getRequestedBound(parameters.isColumnsReversed ? Bound.END : Bound.START, variables);
+            sliceRange.finish = getRequestedBound(parameters.isColumnsReversed ? Bound.START : Bound.END, variables);
             sliceRange.reversed = parameters.isColumnsReversed;
             sliceRange.count = -1; // We use this for range slices, where the count is ignored in favor of the global column count
             thriftSlicePredicate.slice_range = sliceRange;