Merge branch 'cassandra-1.1' into trunk

This commit is contained in:
Sylvain Lebresne 2012-05-22 17:15:09 +02:00
commit 09ff861408
3 changed files with 10 additions and 15 deletions

View File

@ -68,6 +68,7 @@
* (cql3) Add name of parameters in CqlResultSet (CASSANDRA-4242)
* (cql3) Correctly validate order by queries (CASSANDRA-4246)
* rename stress to cassandra-stress for saner packaging (CASSANDRA-4256)
* Fix exception on colum metadata with non-string comparator (CASSANDRA-4269)
Merged from 1.0:
* Fix super columns bug where cache is not updated (CASSANDRA-4190)
* fix maxTimestamp to include row tombstones (CASSANDRA-4116)

View File

@ -85,7 +85,7 @@ public class CFDefinition implements Iterable<CFDefinition.Name>
for (Map.Entry<ByteBuffer, ColumnDefinition> def : cfm.getColumn_metadata().entrySet())
{
ColumnIdentifier id = new ColumnIdentifier(def.getKey());
ColumnIdentifier id = new ColumnIdentifier(def.getKey(), cfm.getColumnDefinitionComparator(def.getValue()));
this.metadata.put(id, new Name(id, Name.Kind.COLUMN_METADATA, def.getValue().getValidator()));
}
}
@ -111,7 +111,7 @@ public class CFDefinition implements Iterable<CFDefinition.Name>
assert cfm.getColumnAliases() == null || cfm.getColumnAliases().isEmpty();
for (Map.Entry<ByteBuffer, ColumnDefinition> def : cfm.getColumn_metadata().entrySet())
{
ColumnIdentifier id = new ColumnIdentifier(def.getKey());
ColumnIdentifier id = new ColumnIdentifier(def.getKey(), cfm.getColumnDefinitionComparator(def.getValue()));
this.metadata.put(id, new Name(id, Name.Kind.COLUMN_METADATA, def.getValue().getValidator()));
}
}
@ -123,7 +123,7 @@ public class CFDefinition implements Iterable<CFDefinition.Name>
{
return cfm.getKeyAlias() == null
? new ColumnIdentifier(DEFAULT_KEY_ALIAS, false)
: new ColumnIdentifier(cfm.getKeyAlias());
: new ColumnIdentifier(cfm.getKeyAlias(), definitionType);
}
private static ColumnIdentifier getColumnId(CFMetaData cfm, int i)
@ -131,14 +131,14 @@ public class CFDefinition implements Iterable<CFDefinition.Name>
List<ByteBuffer> definedNames = cfm.getColumnAliases();
return definedNames == null || i >= definedNames.size()
? new ColumnIdentifier(DEFAULT_COLUMN_ALIAS + (i + 1), false)
: new ColumnIdentifier(cfm.getColumnAliases().get(i));
: new ColumnIdentifier(cfm.getColumnAliases().get(i), definitionType);
}
private static ColumnIdentifier getValueId(CFMetaData cfm)
{
return cfm.getValueAlias() == null
? new ColumnIdentifier(DEFAULT_VALUE_ALIAS, false)
: new ColumnIdentifier(cfm.getValueAlias());
: new ColumnIdentifier(cfm.getValueAlias(), definitionType);
}
public Name get(ColumnIdentifier name)

View File

@ -21,6 +21,7 @@ import java.util.Locale;
import java.nio.charset.CharacterCodingException;
import java.nio.ByteBuffer;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.utils.ByteBufferUtil;
/**
@ -37,17 +38,10 @@ public class ColumnIdentifier implements Comparable<ColumnIdentifier>
this.key = ByteBufferUtil.bytes(this.text);
}
public ColumnIdentifier(ByteBuffer key)
public ColumnIdentifier(ByteBuffer key, AbstractType type)
{
try
{
this.key = key;
this.text = ByteBufferUtil.string(key);
}
catch (CharacterCodingException e)
{
throw new RuntimeException(e);
}
this.key = key;
this.text = type.getString(key);
}
@Override