if (select.isCountOperation())
{
validateCountOperation(select);
ByteBuffer countBytes = ByteBufferUtil.bytes("count");
result.schema = new CqlMetadata(Collections.<ByteBuffer, String>emptyMap(),
Collections.<ByteBuffer, String>emptyMap(),
"AsciiType",
"LongType");
List<Column> columns = Collections.singletonList(new Column(countBytes).setValue(ByteBufferUtil.bytes((long) rows.size())));
result.rows = Collections.singletonList(new CqlRow(countBytes, columns));
return result;
}
// otherwise create resultset from query results
result.schema = new CqlMetadata(new HashMap<ByteBuffer, String>(),
new HashMap<ByteBuffer, String>(),
TypeParser.getShortName(metadata.comparator),
TypeParser.getShortName(metadata.getDefaultValidator()));
List<CqlRow> cqlRows = new ArrayList<CqlRow>(rows.size());
for (org.apache.cassandra.db.Row row : rows)