Search in sources :

Example 1 with ReferencedPriorityQueue

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();
        }
    }
}
Also used : ReferenceEntry(org.apache.hyracks.dataflow.std.util.ReferenceEntry) GroupFrameAccessor(org.apache.hyracks.dataflow.std.sort.util.GroupFrameAccessor) FrameTupleAppender(org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender) ReferencedPriorityQueue(org.apache.hyracks.dataflow.std.util.ReferencedPriorityQueue)

Aggregations

FrameTupleAppender (org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender)1 GroupFrameAccessor (org.apache.hyracks.dataflow.std.sort.util.GroupFrameAccessor)1 ReferenceEntry (org.apache.hyracks.dataflow.std.util.ReferenceEntry)1 ReferencedPriorityQueue (org.apache.hyracks.dataflow.std.util.ReferencedPriorityQueue)1