Java Code Examples for org.apache.flink.runtime.iterative.io.SolutionSetUpdateOutputCollector

The following examples show how to use org.apache.flink.runtime.iterative.io.SolutionSetUpdateOutputCollector. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: Flink-CEPplus   Author: ljygz   File: AbstractIterativeTask.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new solution set update output collector.
 *
 * <p>This collector is used by {@link IterationIntermediateTask} or {@link IterationTailTask} to update the
 * solution set of workset iterations. Depending on the task configuration, either a fast (non-probing)
 * {@link org.apache.flink.runtime.iterative.io.SolutionSetFastUpdateOutputCollector} or normal (re-probing)
 * {@link SolutionSetUpdateOutputCollector} is created.
 *
 * <p>If a non-null delegate is given, the new {@link Collector} will write back to the solution set and also call
 * collect(T) of the delegate.
 *
 * @param delegate null -OR- a delegate collector to be called by the newly created collector
 * @return a new {@link org.apache.flink.runtime.iterative.io.SolutionSetFastUpdateOutputCollector} or
 * {@link SolutionSetUpdateOutputCollector}
 */
protected Collector<OT> createSolutionSetUpdateOutputCollector(Collector<OT> delegate) {
	Broker<Object> solutionSetBroker = SolutionSetBroker.instance();

	Object ss = solutionSetBroker.get(brokerKey());
	if (ss instanceof CompactingHashTable) {
		@SuppressWarnings("unchecked")
		CompactingHashTable<OT> solutionSet = (CompactingHashTable<OT>) ss;
		return new SolutionSetUpdateOutputCollector<OT>(solutionSet, delegate);
	}
	else if (ss instanceof JoinHashMap) {
		@SuppressWarnings("unchecked")
		JoinHashMap<OT> map = (JoinHashMap<OT>) ss;
		return new SolutionSetObjectsUpdateOutputCollector<OT>(map, delegate);
	} else {
		throw new RuntimeException("Unrecognized solution set handle: " + ss);
	}
}
 
Example #2
Source Project: flink   Author: flink-tpc-ds   File: AbstractIterativeTask.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new solution set update output collector.
 *
 * <p>This collector is used by {@link IterationIntermediateTask} or {@link IterationTailTask} to update the
 * solution set of workset iterations. Depending on the task configuration, either a fast (non-probing)
 * {@link org.apache.flink.runtime.iterative.io.SolutionSetFastUpdateOutputCollector} or normal (re-probing)
 * {@link SolutionSetUpdateOutputCollector} is created.
 *
 * <p>If a non-null delegate is given, the new {@link Collector} will write back to the solution set and also call
 * collect(T) of the delegate.
 *
 * @param delegate null -OR- a delegate collector to be called by the newly created collector
 * @return a new {@link org.apache.flink.runtime.iterative.io.SolutionSetFastUpdateOutputCollector} or
 * {@link SolutionSetUpdateOutputCollector}
 */
protected Collector<OT> createSolutionSetUpdateOutputCollector(Collector<OT> delegate) {
	Broker<Object> solutionSetBroker = SolutionSetBroker.instance();

	Object ss = solutionSetBroker.get(brokerKey());
	if (ss instanceof CompactingHashTable) {
		@SuppressWarnings("unchecked")
		CompactingHashTable<OT> solutionSet = (CompactingHashTable<OT>) ss;
		return new SolutionSetUpdateOutputCollector<OT>(solutionSet, delegate);
	}
	else if (ss instanceof JoinHashMap) {
		@SuppressWarnings("unchecked")
		JoinHashMap<OT> map = (JoinHashMap<OT>) ss;
		return new SolutionSetObjectsUpdateOutputCollector<OT>(map, delegate);
	} else {
		throw new RuntimeException("Unrecognized solution set handle: " + ss);
	}
}
 
Example #3
Source Project: flink   Author: apache   File: AbstractIterativeTask.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new solution set update output collector.
 *
 * <p>This collector is used by {@link IterationIntermediateTask} or {@link IterationTailTask} to update the
 * solution set of workset iterations. Depending on the task configuration, either a fast (non-probing)
 * {@link org.apache.flink.runtime.iterative.io.SolutionSetFastUpdateOutputCollector} or normal (re-probing)
 * {@link SolutionSetUpdateOutputCollector} is created.
 *
 * <p>If a non-null delegate is given, the new {@link Collector} will write back to the solution set and also call
 * collect(T) of the delegate.
 *
 * @param delegate null -OR- a delegate collector to be called by the newly created collector
 * @return a new {@link org.apache.flink.runtime.iterative.io.SolutionSetFastUpdateOutputCollector} or
 * {@link SolutionSetUpdateOutputCollector}
 */
protected Collector<OT> createSolutionSetUpdateOutputCollector(Collector<OT> delegate) {
	Broker<Object> solutionSetBroker = SolutionSetBroker.instance();

	Object ss = solutionSetBroker.get(brokerKey());
	if (ss instanceof CompactingHashTable) {
		@SuppressWarnings("unchecked")
		CompactingHashTable<OT> solutionSet = (CompactingHashTable<OT>) ss;
		return new SolutionSetUpdateOutputCollector<OT>(solutionSet, delegate);
	}
	else if (ss instanceof JoinHashMap) {
		@SuppressWarnings("unchecked")
		JoinHashMap<OT> map = (JoinHashMap<OT>) ss;
		return new SolutionSetObjectsUpdateOutputCollector<OT>(map, delegate);
	} else {
		throw new RuntimeException("Unrecognized solution set handle: " + ss);
	}
}