Search in sources :

Example 1 with PreclusteredGroupWriter

use of org.apache.hyracks.dataflow.std.group.preclustered.PreclusteredGroupWriter 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();
        }
    };
}
Also used : AbstractOneInputOneOutputPushRuntime(org.apache.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputPushRuntime) PreclusteredGroupWriter(org.apache.hyracks.dataflow.std.group.preclustered.PreclusteredGroupWriter) IBinaryComparator(org.apache.hyracks.api.dataflow.value.IBinaryComparator) ByteBuffer(java.nio.ByteBuffer)

Example 2 with PreclusteredGroupWriter

use of org.apache.hyracks.dataflow.std.group.preclustered.PreclusteredGroupWriter in project asterixdb by apache.

the class ExternalSortGroupByRunMerger method prepareIntermediateMergeResultWriter.

@Override
protected IFrameWriter prepareIntermediateMergeResultWriter(RunFileWriter mergeFileWriter) throws HyracksDataException {
    IAggregatorDescriptorFactory aggregatorFactory = localSide ? mergeAggregatorFactory : partialAggregatorFactory;
    boolean outputPartial = true;
    return new PreclusteredGroupWriter(ctx, mergeGroupFields, groupByComparators, aggregatorFactory, partialAggRecordDesc, partialAggRecordDesc, mergeFileWriter, outputPartial);
}
Also used : PreclusteredGroupWriter(org.apache.hyracks.dataflow.std.group.preclustered.PreclusteredGroupWriter) IAggregatorDescriptorFactory(org.apache.hyracks.dataflow.std.group.IAggregatorDescriptorFactory)

Example 3 with PreclusteredGroupWriter

use of org.apache.hyracks.dataflow.std.group.preclustered.PreclusteredGroupWriter in project asterixdb by apache.

the class ExternalSortGroupByRunMerger method prepareSkipMergingFinalResultWriter.

@Override
protected IFrameWriter prepareSkipMergingFinalResultWriter(IFrameWriter nextWriter) throws HyracksDataException {
    IAggregatorDescriptorFactory aggregatorFactory = localSide ? partialAggregatorFactory : mergeAggregatorFactory;
    boolean outputPartial = false;
    return new PreclusteredGroupWriter(ctx, groupFields, groupByComparators, aggregatorFactory, inputRecordDesc, outRecordDesc, nextWriter, outputPartial);
}
Also used : PreclusteredGroupWriter(org.apache.hyracks.dataflow.std.group.preclustered.PreclusteredGroupWriter) IAggregatorDescriptorFactory(org.apache.hyracks.dataflow.std.group.IAggregatorDescriptorFactory)

Aggregations

PreclusteredGroupWriter (org.apache.hyracks.dataflow.std.group.preclustered.PreclusteredGroupWriter)3 IAggregatorDescriptorFactory (org.apache.hyracks.dataflow.std.group.IAggregatorDescriptorFactory)2 ByteBuffer (java.nio.ByteBuffer)1 AbstractOneInputOneOutputPushRuntime (org.apache.hyracks.algebricks.runtime.operators.base.AbstractOneInputOneOutputPushRuntime)1 IBinaryComparator (org.apache.hyracks.api.dataflow.value.IBinaryComparator)1