use of org.apache.cassandra.cql3.ColumnIdentifier in project cassandra by apache.
the class QueryPagerTest method queryAndVerifyCells.
private void queryAndVerifyCells(TableMetadata table, boolean reversed, String key) {
ClusteringIndexFilter rowfilter = new ClusteringIndexSliceFilter(Slices.ALL, reversed);
ReadCommand command = SinglePartitionReadCommand.create(table, nowInSec, Util.dk(key), ColumnFilter.all(table), rowfilter);
QueryPager pager = command.getPager(null, ProtocolVersion.CURRENT);
ColumnMetadata staticColumn = table.staticColumns().getSimple(0);
assertEquals(staticColumn.name.toCQLString(), "st");
for (int i = 0; i < 5; i++) {
try (ReadExecutionController controller = pager.executionController();
PartitionIterator partitions = pager.fetchPageInternal(1, controller)) {
try (RowIterator partition = partitions.next()) {
assertCell(partition.staticRow(), staticColumn, 4);
Row row = partition.next();
int cellIndex = !reversed ? i : 4 - i;
assertEquals(row.clustering().bufferAt(0), ByteBufferUtil.bytes(cellIndex));
assertCell(row, table.getColumn(new ColumnIdentifier("v1", false)), cellIndex);
assertCell(row, table.getColumn(new ColumnIdentifier("v2", false)), cellIndex);
// the partition/page should contain just a single regular row
assertFalse(partition.hasNext());
}
}
}
// After processing the 5 rows there should be no more rows to return
try (ReadExecutionController controller = pager.executionController();
PartitionIterator partitions = pager.fetchPageInternal(1, controller)) {
assertFalse(partitions.hasNext());
}
}
use of org.apache.cassandra.cql3.ColumnIdentifier in project stargate-core by tuplejump.
the class RowIndexSupport method loadOldRow.
private void loadOldRow(DecoratedKey dk, ByteBuffer pkBuf, List<Field> fields) {
CellName clusteringKey = tableMapper.makeClusteringKey(pkBuf);
Composite start = tableMapper.start(clusteringKey);
Composite end = tableMapper.end(start);
ColumnSlice columnSlice = new ColumnSlice(start, end);
SliceQueryFilter sliceQueryFilter = new SliceQueryFilter(columnSlice, false, Integer.MAX_VALUE);
QueryFilter queryFilter = new QueryFilter(dk, tableMapper.table.name, sliceQueryFilter, new Date().getTime());
ColumnFamily columnFamily = tableMapper.table.getColumnFamily(queryFilter);
Map<CellName, ColumnFamily> fullSlice = tableMapper.getRows(columnFamily);
ColumnFamily oldDocument = fullSlice.get(clusteringKey);
for (Cell cell : oldDocument) {
CellName cellName = cell.name();
ColumnIdentifier cql3ColName = cellName.cql3ColumnName(tableMapper.cfMetaData);
String actualColName = cql3ColName.toString();
ColumnDefinition columnDefinition = tableMapper.cfMetaData.getColumnDefinition(cql3ColName);
if (options.shouldIndex(actualColName)) {
addFields(cell, actualColName, columnDefinition, fields);
}
}
}
Aggregations