mirror of https://github.com/apache/cassandra
use the subcomparator when toStringing slice commands on subcolumns. this exposes a couple bugs: fix getString in non-string types to accept byte[0], and fix a test to send a long to a LongType subcolumn. patch by jbellis and Evan Weaver for CASSANDRA-377
git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@805868 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
007df950fc
commit
bb464c1f37
|
|
@ -88,7 +88,9 @@ public abstract class ReadCommand
|
|||
|
||||
protected AbstractType getComparator()
|
||||
{
|
||||
return DatabaseDescriptor.getComparator(table, getColumnFamilyName());
|
||||
return queryPath.superColumnName == null
|
||||
? DatabaseDescriptor.getComparator(table, getColumnFamilyName())
|
||||
: DatabaseDescriptor.getSubComparator(table, getColumnFamilyName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ public class LexicalUUIDType extends AbstractType
|
|||
|
||||
public String getString(byte[] bytes)
|
||||
{
|
||||
if (bytes.length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (bytes.length != 16)
|
||||
{
|
||||
throw new MarshalException("UUIDs must be exactly 16 bytes");
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ public class LongType extends AbstractType
|
|||
|
||||
public String getString(byte[] bytes)
|
||||
{
|
||||
if (bytes.length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (bytes.length != 8)
|
||||
{
|
||||
throw new MarshalException("A long is exactly 8 bytes");
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@ public class TimeUUIDType extends AbstractType
|
|||
|
||||
public String getString(byte[] bytes)
|
||||
{
|
||||
if (bytes.length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (bytes.length != 16)
|
||||
{
|
||||
throw new MarshalException("UUIDs must be exactly 16 bytes");
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class TestMutations(CassandraTester):
|
|||
assert _big_slice('Keyspace1', 'key1', ColumnParent('Super1')) == []
|
||||
|
||||
def test_missing_super(self):
|
||||
_expect_missing(lambda: client.get('Keyspace1', 'key1', ColumnPath('Super1', 'sc1', 'c1'), ConsistencyLevel.ONE))
|
||||
_expect_missing(lambda: client.get('Keyspace1', 'key1', ColumnPath('Super1', 'sc1', _i64(1)), ConsistencyLevel.ONE))
|
||||
|
||||
def test_count(self):
|
||||
_insert_simple()
|
||||
|
|
|
|||
Loading…
Reference in New Issue