Java Code Examples for org.apache.flink.runtime.operators.BatchTask#instantiateUserCode()

The following examples show how to use org.apache.flink.runtime.operators.BatchTask#instantiateUserCode() . 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 File: ChainedAllReduceDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	@SuppressWarnings("unchecked")
	final ReduceFunction<IT> red = BatchTask.instantiateUserCode(this.config, userCodeClassLoader, ReduceFunction.class);
	this.reducer = red;
	FunctionUtils.setFunctionRuntimeContext(red, getUdfRuntimeContext());

	TypeSerializerFactory<IT> serializerFactory = this.config.getInputSerializer(0, userCodeClassLoader);
	this.serializer = serializerFactory.getSerializer();

	if (LOG.isDebugEnabled()) {
		LOG.debug("ChainedAllReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
	}
}
 
Example 2
Source File: ChainedReduceCombineDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	this.parent = parent;
	running = true;

	strategy = config.getDriverStrategy();

	reducer = BatchTask.instantiateUserCode(config, userCodeClassLoader, ReduceFunction.class);
	FunctionUtils.setFunctionRuntimeContext(reducer, getUdfRuntimeContext());
}
 
Example 3
Source File: ChainedMapDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	final MapFunction<IT, OT> mapper =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, MapFunction.class);
	this.mapper = mapper;
	FunctionUtils.setFunctionRuntimeContext(mapper, getUdfRuntimeContext());
}
 
Example 4
Source File: ChainedAllReduceDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	final ReduceFunction<IT> red = BatchTask.instantiateUserCode(this.config, userCodeClassLoader, ReduceFunction.class);
	this.reducer = red;
	FunctionUtils.setFunctionRuntimeContext(red, getUdfRuntimeContext());

	TypeSerializerFactory<IT> serializerFactory = this.config.getInputSerializer(0, userCodeClassLoader);
	this.serializer = serializerFactory.getSerializer();

	if (LOG.isDebugEnabled()) {
		LOG.debug("ChainedAllReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
	}
}
 
Example 5
Source File: ChainedFlatMapDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	@SuppressWarnings("unchecked")
	final FlatMapFunction<IT, OT> mapper =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, FlatMapFunction.class);
	this.mapper = mapper;
	FunctionUtils.setFunctionRuntimeContext(mapper, getUdfRuntimeContext());
}
 
Example 6
Source File: SynchronousChainedCombineDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	this.parent = parent;

	@SuppressWarnings("unchecked")
	final GroupCombineFunction<IN, OUT> combiner =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, GroupCombineFunction.class);
	this.combiner = combiner;
	FunctionUtils.setFunctionRuntimeContext(combiner, getUdfRuntimeContext());
}
 
Example 7
Source File: ChainedReduceCombineDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	this.parent = parent;
	running = true;

	strategy = config.getDriverStrategy();

	reducer = BatchTask.instantiateUserCode(config, userCodeClassLoader, ReduceFunction.class);
	FunctionUtils.setFunctionRuntimeContext(reducer, getUdfRuntimeContext());
}
 
Example 8
Source File: ChainedMapDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	@SuppressWarnings("unchecked")
	final MapFunction<IT, OT> mapper =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, MapFunction.class);
	this.mapper = mapper;
	FunctionUtils.setFunctionRuntimeContext(mapper, getUdfRuntimeContext());
}
 
Example 9
Source File: GroupCombineChainedDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	this.parent = parent;

	@SuppressWarnings("unchecked")
	final GroupReduceFunction<IN, OUT> combiner =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, GroupReduceFunction.class);
	this.reducer = combiner;
	FunctionUtils.setFunctionRuntimeContext(combiner, getUdfRuntimeContext());
}
 
Example 10
Source File: SynchronousChainedCombineDriver.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	this.parent = parent;

	@SuppressWarnings("unchecked")
	final GroupCombineFunction<IN, OUT> combiner =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, GroupCombineFunction.class);
	this.combiner = combiner;
	FunctionUtils.setFunctionRuntimeContext(combiner, getUdfRuntimeContext());
}
 
Example 11
Source File: ChainedFlatMapDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	@SuppressWarnings("unchecked")
	final FlatMapFunction<IT, OT> mapper =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, FlatMapFunction.class);
	this.mapper = mapper;
	FunctionUtils.setFunctionRuntimeContext(mapper, getUdfRuntimeContext());
}
 
Example 12
Source File: SynchronousChainedCombineDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	this.parent = parent;

	@SuppressWarnings("unchecked")
	final GroupCombineFunction<IN, OUT> combiner =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, GroupCombineFunction.class);
	this.combiner = combiner;
	FunctionUtils.setFunctionRuntimeContext(combiner, getUdfRuntimeContext());
}
 
Example 13
Source File: ChainedReduceCombineDriver.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	this.parent = parent;
	running = true;

	strategy = config.getDriverStrategy();

	reducer = BatchTask.instantiateUserCode(config, userCodeClassLoader, ReduceFunction.class);
	FunctionUtils.setFunctionRuntimeContext(reducer, getUdfRuntimeContext());
}
 
Example 14
Source File: ChainedMapDriver.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	@SuppressWarnings("unchecked")
	final MapFunction<IT, OT> mapper =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, MapFunction.class);
	this.mapper = mapper;
	FunctionUtils.setFunctionRuntimeContext(mapper, getUdfRuntimeContext());
}
 
Example 15
Source File: GroupCombineChainedDriver.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	this.parent = parent;

	@SuppressWarnings("unchecked")
	final GroupReduceFunction<IN, OUT> combiner =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, GroupReduceFunction.class);
	this.reducer = combiner;
	FunctionUtils.setFunctionRuntimeContext(combiner, getUdfRuntimeContext());
}
 
Example 16
Source File: ChainedAllReduceDriver.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	@SuppressWarnings("unchecked")
	final ReduceFunction<IT> red = BatchTask.instantiateUserCode(this.config, userCodeClassLoader, ReduceFunction.class);
	this.reducer = red;
	FunctionUtils.setFunctionRuntimeContext(red, getUdfRuntimeContext());

	TypeSerializerFactory<IT> serializerFactory = this.config.getInputSerializer(0, userCodeClassLoader);
	this.serializer = serializerFactory.getSerializer();

	if (LOG.isDebugEnabled()) {
		LOG.debug("ChainedAllReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
	}
}
 
Example 17
Source File: ChainedFlatMapDriver.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(AbstractInvokable parent) {
	@SuppressWarnings("unchecked")
	final FlatMapFunction<IT, OT> mapper =
		BatchTask.instantiateUserCode(this.config, userCodeClassLoader, FlatMapFunction.class);
	this.mapper = mapper;
	FunctionUtils.setFunctionRuntimeContext(mapper, getUdfRuntimeContext());
}