backport CASSANDRA-1866 from 0.7

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.6@1050753 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2010-12-19 03:38:41 +00:00
parent aa2c396910
commit c484dffbb8
2 changed files with 14 additions and 2 deletions

View File

@ -133,6 +133,13 @@ public class ThriftValidation
throw new InvalidRequestException("supercolumn may not be specified for standard CF " + column_path_or_parent.column_family);
}
}
if (cfType.equals("Super"))
{
if (column_path_or_parent.super_column == null && column_path_or_parent.column != null)
{
throw new InvalidRequestException("A column cannot be specified without specifying a super column for removal on super CF " + column_path_or_parent.column_family);
}
}
if (column_path_or_parent.column != null)
{
validateColumns(tablename, column_path_or_parent.column_family, column_path_or_parent.super_column, Arrays.asList(column_path_or_parent.column));

View File

@ -163,8 +163,8 @@ def _verify_super(supercf='Super1', key='key1'):
def _expect_exception(fn, type_):
try:
r = fn()
except type_:
pass
except type_, e:
return e
else:
raise Exception('expected %s; got %s' % (type_.__name__, r))
@ -712,6 +712,11 @@ class TestMutations(CassandraTester):
Column(_i64(7), 'value7', 0)])]
assert super_columns == super_columns_expected, super_columns
# shouldn't be able to specify a column w/o a super column for remove
cp = ColumnPath(column_family='Super1', column=_i64(6))
e = _expect_exception(lambda: client.remove('Keyspace1', 'key1', cp, 5, ConsistencyLevel.ONE), InvalidRequestException)
assert e.why.find("column cannot be specified without") >= 0
def test_super_cf_remove_supercolumn(self):
_insert_simple()
_insert_super()