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:15 UTC
[2/5] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
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++;