use of org.apache.hyracks.api.comm.FixedSizeFrame in project asterixdb by apache.
the class TopKRunGeneratorTest method prepareSortedData.
private ByteBuffer prepareSortedData(Map<Integer, String> keyValuePair) throws HyracksDataException {
ByteBuffer buffer = ByteBuffer.allocate(PAGE_SIZE * NUM_PAGES);
IFrame inputFrame = new FixedSizeFrame(buffer);
FrameTupleAppender appender = new FrameTupleAppender();
appender.reset(inputFrame, true);
ArrayTupleBuilder builder = new ArrayTupleBuilder(RecordDesc.getFieldCount());
for (Map.Entry<Integer, String> entry : keyValuePair.entrySet()) {
builder.reset();
builder.addField(SerDers[0], entry.getKey());
builder.addField(SerDers[1], entry.getValue());
appender.append(builder.getFieldEndOffsets(), builder.getByteArray(), 0, builder.getSize());
}
return buffer;
}
Aggregations