Search in sources :

Example 1 with DefaultRow

use of com.datastax.oss.driver.internal.core.cql.DefaultRow in project java-driver by datastax.

the class ContinuousCqlRequestHandler method createResultSet.

@NonNull
@Override
protected DefaultContinuousAsyncResultSet createResultSet(@NonNull Statement<?> statement, @NonNull Rows rows, @NonNull ExecutionInfo executionInfo, @NonNull ColumnDefinitions columnDefinitions) {
    Queue<List<ByteBuffer>> data = rows.getData();
    CountingIterator<Row> iterator = new CountingIterator<Row>(data.size()) {

        @Override
        protected Row computeNext() {
            List<ByteBuffer> rowData = data.poll();
            return (rowData == null) ? endOfData() : new DefaultRow(columnDefinitions, rowData, context);
        }
    };
    DseRowsMetadata metadata = (DseRowsMetadata) rows.getMetadata();
    return new DefaultContinuousAsyncResultSet(iterator, columnDefinitions, metadata.continuousPageNumber, !metadata.isLastContinuousPage, executionInfo, this);
}
Also used : CountingIterator(com.datastax.oss.driver.internal.core.util.CountingIterator) List(java.util.List) Row(com.datastax.oss.driver.api.core.cql.Row) DefaultRow(com.datastax.oss.driver.internal.core.cql.DefaultRow) DseRowsMetadata(com.datastax.dse.protocol.internal.response.result.DseRowsMetadata) DefaultRow(com.datastax.oss.driver.internal.core.cql.DefaultRow) ByteBuffer(java.nio.ByteBuffer) NonNull(edu.umd.cs.findbugs.annotations.NonNull)

Aggregations

DseRowsMetadata (com.datastax.dse.protocol.internal.response.result.DseRowsMetadata)1 Row (com.datastax.oss.driver.api.core.cql.Row)1 DefaultRow (com.datastax.oss.driver.internal.core.cql.DefaultRow)1 CountingIterator (com.datastax.oss.driver.internal.core.util.CountingIterator)1 NonNull (edu.umd.cs.findbugs.annotations.NonNull)1 ByteBuffer (java.nio.ByteBuffer)1 List (java.util.List)1