Search in sources :

Example 1 with GroupFrameAccessor

use of org.apache.hyracks.dataflow.std.sort.util.GroupFrameAccessor in project asterixdb by apache.

the class AbstractRunGeneratorTest method matchResult.

static void matchResult(IHyracksTaskContext ctx, List<GeneratedRunFileReader> runs, Map<Integer, String> keyValuePair) throws HyracksDataException {
    HashMap<Integer, String> copyMap2 = new HashMap<>(keyValuePair);
    int maxFrameSizes = 0;
    for (GeneratedRunFileReader run : runs) {
        maxFrameSizes = Math.max(maxFrameSizes, run.getMaxFrameSize());
    }
    GroupVSizeFrame gframe = new GroupVSizeFrame(ctx, maxFrameSizes);
    GroupFrameAccessor gfta = new GroupFrameAccessor(ctx.getInitialFrameSize(), RecordDesc);
    assertReadSorted(runs, gfta, gframe, copyMap2);
}
Also used : GroupVSizeFrame(org.apache.hyracks.dataflow.std.sort.util.GroupVSizeFrame) HashMap(java.util.HashMap) GroupFrameAccessor(org.apache.hyracks.dataflow.std.sort.util.GroupFrameAccessor) GeneratedRunFileReader(org.apache.hyracks.dataflow.common.io.GeneratedRunFileReader)

Example 2 with GroupFrameAccessor

use of org.apache.hyracks.dataflow.std.sort.util.GroupFrameAccessor 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

GroupFrameAccessor (org.apache.hyracks.dataflow.std.sort.util.GroupFrameAccessor)2 HashMap (java.util.HashMap)1 FrameTupleAppender (org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender)1 GeneratedRunFileReader (org.apache.hyracks.dataflow.common.io.GeneratedRunFileReader)1 GroupVSizeFrame (org.apache.hyracks.dataflow.std.sort.util.GroupVSizeFrame)1 ReferenceEntry (org.apache.hyracks.dataflow.std.util.ReferenceEntry)1 ReferencedPriorityQueue (org.apache.hyracks.dataflow.std.util.ReferencedPriorityQueue)1