fix regression introduced by ReadCommand refactor (get_slice can return column_t from a standard cf, or from a supercolumn in a super cf). patch by jbellis.

git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@769629 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2009-04-29 02:01:56 +00:00
parent e181fdc4e0
commit ef2f631ebe
2 changed files with 11 additions and 9 deletions

View File

@ -23,14 +23,16 @@ import java.io.IOException;
public class SliceReadCommand extends ReadCommand
{
public final String columnFamily;
/* for a slice of a standard column, cFC should only be the CF name.
for a supercolumn slice, it will be CF:supercolumn. */
public final String columnFamilyColumn;
public final int start;
public final int count;
public SliceReadCommand(String table, String key, String columnFamily, int start, int count)
public SliceReadCommand(String table, String key, String columnFamilyColumn, int start, int count)
{
super(table, key, CMD_TYPE_GET_SLICE);
this.columnFamily = columnFamily;
this.columnFamilyColumn = columnFamilyColumn;
this.start = start;
this.count = count;
}
@ -38,13 +40,13 @@ public class SliceReadCommand extends ReadCommand
@Override
public String getColumnFamilyName()
{
return columnFamily;
return RowMutation.getColumnAndColumnFamily(columnFamilyColumn)[0];
}
@Override
public ReadCommand copy()
{
ReadCommand readCommand= new SliceReadCommand(table, key, columnFamily, start, count);
ReadCommand readCommand = new SliceReadCommand(table, key, columnFamilyColumn, start, count);
readCommand.setDigestQuery(isDigestQuery());
return readCommand;
}
@ -52,7 +54,7 @@ public class SliceReadCommand extends ReadCommand
@Override
public Row getRow(Table table) throws IOException
{
return table.getRow(key, columnFamily, start, count);
return table.getRow(key, columnFamilyColumn, start, count);
}
@Override
@ -61,7 +63,7 @@ public class SliceReadCommand extends ReadCommand
return "GetSliceReadMessage(" +
"table='" + table + '\'' +
", key='" + key + '\'' +
", columnFamily='" + columnFamily + '\'' +
", columnFamily='" + columnFamilyColumn + '\'' +
", start='" + start + '\'' +
", count='" + count + '\'' +
')';
@ -77,7 +79,7 @@ class SliceReadCommandSerializer extends ReadCommandSerializer
dos.writeBoolean(realRM.isDigestQuery());
dos.writeUTF(realRM.table);
dos.writeUTF(realRM.key);
dos.writeUTF(realRM.columnFamily);
dos.writeUTF(realRM.columnFamilyColumn);
dos.writeInt(realRM.start);
dos.writeInt(realRM.count);
}

View File

@ -197,7 +197,7 @@ class TestMutations(CassandraTester):
client.remove('Table1', 'key1', 'Super1:sc2', 5, True)
time.sleep(0.1)
_expect_missing(lambda: client.get_column('Table1', 'key1', 'Super1:sc2:c5'))
actual = client.get_slice_super('Table1', 'key1', 'Super1:sc2', -1, -1)
actual = client.get_slice('Table1', 'key1', 'Super1:sc2', -1, -1)
assert actual == [], actual
scs = [superColumn_t(name='sc1',
columns=[column_t(columnName='c4', value='value4', timestamp=0)])]