Search in sources :

Example 31 with FrameTupleAppender

use of org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender in project asterixdb by apache.

the class FeedTupleForwarder method initialize.

@Override
public void initialize(IHyracksTaskContext ctx, IFrameWriter writer) throws HyracksDataException {
    if (!initialized) {
        this.frame = new VSizeFrame(ctx);
        this.writer = writer;
        this.appender = new FrameTupleAppender(frame);
        initialized = true;
    }
}
Also used : FrameTupleAppender(org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender) VSizeFrame(org.apache.hyracks.api.comm.VSizeFrame)

Example 32 with FrameTupleAppender

use of org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender in project asterixdb by apache.

the class FrameFullTupleForwarder method initialize.

@Override
public void initialize(IHyracksTaskContext ctx, IFrameWriter writer) throws HyracksDataException {
    this.appender = new FrameTupleAppender();
    this.frame = new VSizeFrame(ctx);
    this.writer = writer;
    appender.reset(frame, true);
}
Also used : FrameTupleAppender(org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender) VSizeFrame(org.apache.hyracks.api.comm.VSizeFrame)

Example 33 with FrameTupleAppender

use of org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender in project asterixdb by apache.

the class RateControlledTupleForwarder method initialize.

@Override
public void initialize(IHyracksTaskContext ctx, IFrameWriter writer) throws HyracksDataException {
    this.appender = new FrameTupleAppender();
    this.frame = new VSizeFrame(ctx);
    this.writer = writer;
    appender.reset(frame, true);
}
Also used : FrameTupleAppender(org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender) VSizeFrame(org.apache.hyracks.api.comm.VSizeFrame)

Example 34 with FrameTupleAppender

use of org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender in project asterixdb by apache.

the class OptimizedHybridHashJoin method flushBigProbeObjectToDisk.

private void flushBigProbeObjectToDisk(int pid, FrameTupleAccessor accessorProbe, int i) throws HyracksDataException {
    if (bigProbeFrameAppender == null) {
        bigProbeFrameAppender = new FrameTupleAppender(new VSizeFrame(ctx));
    }
    RunFileWriter runFileWriter = getSpillWriterOrCreateNewOneIfNotExist(pid, SIDE.PROBE);
    if (!bigProbeFrameAppender.append(accessorProbe, i)) {
        throw new HyracksDataException("The given tuple is too big");
    }
    bigProbeFrameAppender.write(runFileWriter, true);
}
Also used : FrameTupleAppender(org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender) VSizeFrame(org.apache.hyracks.api.comm.VSizeFrame) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) RunFileWriter(org.apache.hyracks.dataflow.common.io.RunFileWriter)

Example 35 with FrameTupleAppender

use of org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender 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)42 VSizeFrame (org.apache.hyracks.api.comm.VSizeFrame)32 ArrayTupleBuilder (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder)17 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)15 FrameTupleAccessor (org.apache.hyracks.dataflow.common.comm.io.FrameTupleAccessor)14 DataOutput (java.io.DataOutput)10 IFrame (org.apache.hyracks.api.comm.IFrame)8 ByteBuffer (java.nio.ByteBuffer)7 IOException (java.io.IOException)6 HashMap (java.util.HashMap)6 FixedSizeFrame (org.apache.hyracks.api.comm.FixedSizeFrame)6 IFrameTupleAppender (org.apache.hyracks.api.comm.IFrameTupleAppender)6 IFrameWriter (org.apache.hyracks.api.comm.IFrameWriter)6 FrameTupleReference (org.apache.hyracks.dataflow.common.data.accessors.FrameTupleReference)6 IFrameTupleAccessor (org.apache.hyracks.api.comm.IFrameTupleAccessor)5 RecordDescriptor (org.apache.hyracks.api.dataflow.value.RecordDescriptor)5 ITupleReference (org.apache.hyracks.dataflow.common.data.accessors.ITupleReference)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 IHyracksTaskContext (org.apache.hyracks.api.context.IHyracksTaskContext)4