Search in sources :

Example 1 with AbstractOneInputSourcePushRuntime

use of org.apache.hyracks.algebricks.runtime.operators.base.AbstractOneInputSourcePushRuntime in project asterixdb by apache.

the class EmptyTupleSourceRuntimeFactory method createPushRuntime.

@Override
public IPushRuntime createPushRuntime(final IHyracksTaskContext ctx) throws HyracksDataException {
    return new AbstractOneInputSourcePushRuntime() {

        private final ArrayTupleBuilder tb = new ArrayTupleBuilder(0);

        private final FrameTupleAppender appender = new FrameTupleAppender(new VSizeFrame(ctx));

        @Override
        public void open() throws HyracksDataException {
            writer.open();
            if (!appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0, tb.getSize())) {
                throw new IllegalStateException();
            }
            appender.write(writer, true);
        }

        @Override
        public void close() throws HyracksDataException {
            writer.close();
        }

        @Override
        public void flush() throws HyracksDataException {
            appender.flush(writer);
        }
    };
}
Also used : AbstractOneInputSourcePushRuntime(org.apache.hyracks.algebricks.runtime.operators.base.AbstractOneInputSourcePushRuntime) FrameTupleAppender(org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender) ArrayTupleBuilder(org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder) VSizeFrame(org.apache.hyracks.api.comm.VSizeFrame)

Aggregations

AbstractOneInputSourcePushRuntime (org.apache.hyracks.algebricks.runtime.operators.base.AbstractOneInputSourcePushRuntime)1 VSizeFrame (org.apache.hyracks.api.comm.VSizeFrame)1 ArrayTupleBuilder (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder)1 FrameTupleAppender (org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender)1