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 2014/04/01 11:30:14 UTC

[1/5] git commit: Fix LIMIT with static columns

Repository: cassandra
Updated Branches:
  refs/heads/trunk 5cdfa69ca -> 6660970c3


Fix LIMIT with static columns

patch by slebresne; reviewed by iamaleksey for CASSANDRA-6956


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

Branch: refs/heads/trunk
Commit: abc6565e260d07614a400b0a83a56a20a7a0722f
Parents: a90b98e
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Apr 1 11:02:15 2014 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Apr 1 11:02:15 2014 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../cassandra/db/filter/ColumnCounter.java      | 23 ++++++++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/abc6565e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3326c6c..8bfc8b9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -37,6 +37,7 @@
  * Add QueryHandler interface (CASSANDRA-6659)
  * Track liveRatio per-memtable, not per-CF (CASSANDRA-6945)
  * Make sure upgradesstables keeps sstable level (CASSANDRA-6958)
+ * Fix LIMT with static columns (CASSANDRA-6956)
 Merged from 1.2:
  * Add UNLOGGED, COUNTER options to BATCH documentation (CASSANDRA-6816)
  * add extra SSL cipher suites (CASSANDRA-6613)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/abc6565e/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/filter/ColumnCounter.java b/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
index c2c0ade..83b138c 100644
--- a/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
+++ b/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
@@ -77,7 +77,8 @@ public class ColumnCounter
     {
         private final CompositeType type;
         private final int toGroup;
-        private ByteBuffer[] last;
+        private ByteBuffer[] previous;
+        private boolean previousGroupIsStatic;
 
         /**
          * A column counter that count only 1 for all the columns sharing a
@@ -115,12 +116,17 @@ public class ColumnCounter
             ByteBuffer[] current = type.split(column.name());
             assert current.length >= toGroup;
 
-            if (last != null)
+            if (previous == null)
+            {
+                // Only the first group can be static
+                previousGroupIsStatic = type.isStaticName(column.name());
+            }
+            else
             {
                 boolean isSameGroup = true;
                 for (int i = 0; i < toGroup; i++)
                 {
-                    if (ByteBufferUtil.compareUnsigned(last[i], current[i]) != 0)
+                    if (ByteBufferUtil.compareUnsigned(previous[i], current[i]) != 0)
                     {
                         isSameGroup = false;
                         break;
@@ -129,10 +135,19 @@ public class ColumnCounter
 
                 if (isSameGroup)
                     return;
+
+                // We want to count the static group as 1 (CQL) row only if it's the only
+                // group in the partition. So, since we have already counted it at this point,
+                // just don't count the 2nd group if there is one and the first one was static
+                if (previousGroupIsStatic)
+                {
+                    previousGroupIsStatic = false;
+                    return;
+                }
             }
 
             live++;
-            last = current;
+            previous = current;
         }
     }
 }


[3/5] git commit: Fix 6956 patch

Posted by sl...@apache.org.
Fix 6956 patch


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

Branch: refs/heads/trunk
Commit: d8c29a3f7e482c99a075f581902c0ed7d142cd6e
Parents: abc6565
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Apr 1 11:28:48 2014 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Apr 1 11:28:48 2014 +0200

----------------------------------------------------------------------
 .../org/apache/cassandra/db/filter/ColumnCounter.java | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d8c29a3f/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/filter/ColumnCounter.java b/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
index 83b138c..814d8ed 100644
--- a/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
+++ b/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
@@ -123,13 +123,16 @@ public class ColumnCounter
             }
             else
             {
-                boolean isSameGroup = true;
-                for (int i = 0; i < toGroup; i++)
+                boolean isSameGroup = previousGroupIsStatic == type.isStaticName(column.name());
+                if (isSameGroup)
                 {
-                    if (ByteBufferUtil.compareUnsigned(previous[i], current[i]) != 0)
+                    for (int i = 0; i < toGroup; i++)
                     {
-                        isSameGroup = false;
-                        break;
+                        if (ByteBufferUtil.compareUnsigned(previous[i], current[i]) != 0)
+                        {
+                            isSameGroup = false;
+                            break;
+                        }
                     }
                 }
 
@@ -141,6 +144,7 @@ public class ColumnCounter
                 // just don't count the 2nd group if there is one and the first one was static
                 if (previousGroupIsStatic)
                 {
+                    previous = current;
                     previousGroupIsStatic = false;
                     return;
                 }


[2/5] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1

Posted by sl...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	src/java/org/apache/cassandra/db/filter/ColumnCounter.java


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

Branch: refs/heads/trunk
Commit: 6776136a66a08636b2ddde7e75b39651460fb0ae
Parents: 26191ca abc6565
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Apr 1 11:09:25 2014 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Apr 1 11:09:25 2014 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../cassandra/db/filter/ColumnCounter.java      | 28 ++++++++++++++------
 2 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6776136a/CHANGES.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6776136a/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/filter/ColumnCounter.java
index 982cd62,83b138c..b8a9563
--- a/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
+++ b/src/java/org/apache/cassandra/db/filter/ColumnCounter.java
@@@ -73,9 -75,10 +73,9 @@@ public class ColumnCounte
  
      public static class GroupByPrefix extends ColumnCounter
      {
 -        private final CompositeType type;
 +        private final CellNameType type;
          private final int toGroup;
-         private CellName last;
 -        private ByteBuffer[] previous;
 -        private boolean previousGroupIsStatic;
++        private CellName previous;
  
          /**
           * A column counter that count only 1 for all the columns sharing a
@@@ -110,23 -113,37 +110,35 @@@
                  return;
              }
  
 -            ByteBuffer[] current = type.split(column.name());
 -            assert current.length >= toGroup;
 +            CellName current = cell.name();
 +            assert current.size() >= toGroup;
  
-             if (last != null)
 -            if (previous == null)
 -            {
 -                // Only the first group can be static
 -                previousGroupIsStatic = type.isStaticName(column.name());
 -            }
 -            else
++            if (previous != null)
              {
--                boolean isSameGroup = true;
--                for (int i = 0; i < toGroup; i++)
++                boolean isSameGroup = previous.isStatic() == current.isStatic();
++                if (isSameGroup)
                  {
-                     if (type.subtype(i).compare(last.get(i), current.get(i)) != 0)
 -                    if (ByteBufferUtil.compareUnsigned(previous[i], current[i]) != 0)
++                    for (int i = 0; i < toGroup; i++)
                      {
--                        isSameGroup = false;
--                        break;
++                        if (type.subtype(i).compare(previous.get(i), current.get(i)) != 0)
++                        {
++                            isSameGroup = false;
++                            break;
++                        }
                      }
                  }
  
                  if (isSameGroup)
                      return;
+ 
+                 // We want to count the static group as 1 (CQL) row only if it's the only
+                 // group in the partition. So, since we have already counted it at this point,
+                 // just don't count the 2nd group if there is one and the first one was static
 -                if (previousGroupIsStatic)
++                if (previous.isStatic())
+                 {
 -                    previousGroupIsStatic = false;
++                    previous = current;
+                     return;
+                 }
              }
  
              live++;


[4/5] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1

Posted by sl...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	src/java/org/apache/cassandra/db/filter/ColumnCounter.java


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

Branch: refs/heads/trunk
Commit: 353b2147b80eebab981434e1fd3f0e222428e664
Parents: 6776136 d8c29a3
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Apr 1 11:29:45 2014 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Apr 1 11:29:45 2014 +0200

----------------------------------------------------------------------

----------------------------------------------------------------------



[5/5] git commit: Merge branch 'cassandra-2.1' into trunk

Posted by sl...@apache.org.
Merge branch 'cassandra-2.1' into trunk


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

Branch: refs/heads/trunk
Commit: 6660970c397a0ac53881422a35920bee2bf2d5f7
Parents: 5cdfa69 353b214
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Apr 1 11:30:06 2014 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Apr 1 11:30:06 2014 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../cassandra/db/filter/ColumnCounter.java      | 28 ++++++++++++++------
 2 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6660970c/CHANGES.txt
----------------------------------------------------------------------