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 2013/12/20 21:50:38 UTC
git commit: Fix AbstractCellName.makeCellName for collections
Updated Branches:
refs/heads/trunk 8614bea29 -> 486f0792d
Fix AbstractCellName.makeCellName for collections
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/486f0792
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/486f0792
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/486f0792
Branch: refs/heads/trunk
Commit: 486f0792d43f03c059f4d2dc501db8b8183c4ea2
Parents: 8614bea
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Dec 20 21:49:51 2013 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Dec 20 21:50:19 2013 +0100
----------------------------------------------------------------------
.../db/composites/AbstractCellNameType.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/486f0792/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java b/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java
index 2ca3b33..83030a6 100644
--- a/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java
+++ b/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java
@@ -209,7 +209,21 @@ public abstract class AbstractCellNameType extends AbstractCType implements Cell
for (int i = 0; i < components.length; i++)
{
Object c = components[i];
- rawComponents[i] = c instanceof ByteBuffer ? (ByteBuffer)c : ((AbstractType)subtype(i)).decompose(c);
+ if (c instanceof ByteBuffer)
+ {
+ rawComponents[i] = (ByteBuffer)c;
+ }
+ else
+ {
+ AbstractType<?> type = (AbstractType)subtype(i);
+ // If it's a collection type, we need to find the right collection and use the key comparator (since we're building a cell name)
+ if (type instanceof ColumnToCollectionType)
+ {
+ assert i > 0;
+ type = ((ColumnToCollectionType)type).defined.get(rawComponents[i-1]).nameComparator();
+ }
+ rawComponents[i] = ((AbstractType)type).decompose(c);
+ }
}
return makeCellName(rawComponents);
}