use of org.apache.flink.runtime.util.ReusingKeyGroupedIterator in project flink by apache.
the class GroupReduceDriver method run.
@Override
public void run() throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug(this.taskContext.formatLogString("GroupReducer preprocessing done. Running GroupReducer code."));
}
final Counter numRecordsOut = this.taskContext.getMetricGroup().getIOMetricGroup().getNumRecordsOutCounter();
// cache references on the stack
final GroupReduceFunction<IT, OT> stub = this.taskContext.getStub();
final Collector<OT> output = new CountingCollector<>(this.taskContext.getOutputCollector(), numRecordsOut);
if (objectReuseEnabled) {
final ReusingKeyGroupedIterator<IT> iter = new ReusingKeyGroupedIterator<IT>(this.input, this.serializer, this.comparator);
// run stub implementation
while (this.running && iter.nextKey()) {
stub.reduce(iter.getValues(), output);
}
} else {
final NonReusingKeyGroupedIterator<IT> iter = new NonReusingKeyGroupedIterator<IT>(this.input, this.comparator);
// run stub implementation
while (this.running && iter.nextKey()) {
stub.reduce(iter.getValues(), output);
}
}
}
Aggregations