use of org.apache.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputPushRuntime in project asterixdb by apache.
the class InMemorySortRuntimeFactory method createOneOutputPushRuntime.
@Override
public AbstractOneInputOneOutputPushRuntime createOneOutputPushRuntime(final IHyracksTaskContext ctx) throws HyracksDataException {
return new AbstractOneInputOneOutputPushRuntime() {
FrameSorterMergeSort frameSorter = null;
@Override
public void open() throws HyracksDataException {
writer.open();
if (frameSorter == null) {
IFrameBufferManager manager = new VariableFrameMemoryManager(new VariableFramePool(ctx, VariableFramePool.UNLIMITED_MEMORY), FrameFreeSlotPolicyFactory.createFreeSlotPolicy(EnumFreeSlotPolicy.LAST_FIT));
frameSorter = new FrameSorterMergeSort(ctx, manager, sortFields, firstKeyNormalizerFactory, comparatorFactories, outputRecordDesc);
}
frameSorter.reset();
}
@Override
public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
frameSorter.insertFrame(buffer);
}
@Override
public void fail() throws HyracksDataException {
writer.fail();
}
@Override
public void close() throws HyracksDataException {
try {
frameSorter.sort();
frameSorter.flush(writer);
} finally {
writer.close();
}
}
};
}
use of org.apache.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputPushRuntime in project asterixdb by apache.
the class MicroPreClusteredGroupRuntimeFactory method createOneOutputPushRuntime.
@Override
public AbstractOneInputOneOutputPushRuntime createOneOutputPushRuntime(final IHyracksTaskContext ctx) throws HyracksDataException {
final IBinaryComparator[] comparators = new IBinaryComparator[comparatorFactories.length];
for (int i = 0; i < comparatorFactories.length; ++i) {
comparators[i] = comparatorFactories[i].createBinaryComparator();
}
return new AbstractOneInputOneOutputPushRuntime() {
private PreclusteredGroupWriter pgw;
@Override
public void open() throws HyracksDataException {
pgw = new PreclusteredGroupWriter(ctx, groupFields, comparators, aggregatorFactory, inRecordDesc, outRecordDesc, writer);
pgw.open();
}
@Override
public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
pgw.nextFrame(buffer);
}
@Override
public void fail() throws HyracksDataException {
pgw.fail();
}
@Override
public void close() throws HyracksDataException {
pgw.close();
}
@Override
public void flush() throws HyracksDataException {
pgw.flush();
}
};
}
Aggregations