use of com.facebook.presto.spark.execution.PrestoSparkRowBatch.RowTupleSupplier in project presto by prestodb.
the class TestPrestoSparkRowBatch method getEntries.
private static List<List<Row>> getEntries(PrestoSparkRowBatch rowBatch) {
ImmutableList.Builder<List<Row>> entries = ImmutableList.builder();
RowTupleSupplier rowTupleSupplier = rowBatch.createRowTupleSupplier();
while (true) {
Tuple2<MutablePartitionId, PrestoSparkMutableRow> next = rowTupleSupplier.getNext();
if (next == null) {
break;
}
ImmutableList.Builder<Row> entry = ImmutableList.builder();
int partition = next._1.getPartition();
PrestoSparkMutableRow mutableRow = next._2;
ByteBuffer buffer = mutableRow.getBuffer();
buffer.order(LITTLE_ENDIAN);
short rowCount = buffer.getShort();
assertEquals(mutableRow.getPositionCount(), rowCount);
for (int i = 0; i < rowCount; i++) {
entry.add(new Row(partition, readRowData(buffer)));
}
entries.add(entry.build());
}
return entries.build();
}
Aggregations