use of org.apache.hyracks.dataflow.std.util.ReferencedPriorityQueue in project asterixdb by apache.
the class RunMergingFrameReader method open.
@Override
public void open() throws HyracksDataException {
tupleCount = 0;
tupleAccessors = new IFrameTupleAccessor[runCursors.size()];
outFrameAppender = new FrameTupleAppender();
Comparator<ReferenceEntry> comparator = createEntryComparator(comparators);
topTuples = new ReferencedPriorityQueue(runCursors.size(), comparator, sortFields, nmkComputer);
tupleIndexes = new int[runCursors.size()];
for (int i = 0; i < runCursors.size(); i++) {
tupleIndexes[i] = 0;
int runIndex = topTuples.peek().getRunid();
runCursors.get(runIndex).open();
if (runCursors.get(runIndex).nextFrame(inFrames.get(runIndex))) {
tupleAccessors[runIndex] = new GroupFrameAccessor(ctx.getInitialFrameSize(), recordDesc);
tupleAccessors[runIndex].reset(inFrames.get(runIndex).getBuffer());
setNextTopTuple(runIndex, tupleIndexes, runCursors, inFrames, tupleAccessors, topTuples);
} else {
closeRun(runIndex, runCursors, tupleAccessors);
topTuples.pop();
}
}
}
Aggregations