org.apache.flink.streaming.api.functions.co.CoMapFunction Java Examples

The following examples show how to use org.apache.flink.streaming.api.functions.co.CoMapFunction. 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: ConnectedStreams.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Applies a CoMap transformation on a {@link ConnectedStreams} and maps
 * the output to a common type. The transformation calls a
 * {@link CoMapFunction#map1} for each element of the first input and
 * {@link CoMapFunction#map2} for each element of the second input. Each
 * CoMapFunction call returns exactly one element.
 *
 * @param coMapper The CoMapFunction used to jointly transform the two input DataStreams
 * @return The transformed {@link DataStream}
 */
public <R> SingleOutputStreamOperator<R> map(CoMapFunction<IN1, IN2, R> coMapper) {

	TypeInformation<R> outTypeInfo = TypeExtractor.getBinaryOperatorReturnType(
		coMapper,
		CoMapFunction.class,
		0,
		1,
		2,
		TypeExtractor.NO_INDEX,
		getType1(),
		getType2(),
		Utils.getCallLocationName(),
		true);

	return transform("Co-Map", outTypeInfo, new CoStreamMap<>(inputStream1.clean(coMapper)));

}
 
Example #2
Source File: ConnectedStreams.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Applies a CoMap transformation on a {@link ConnectedStreams} and maps
 * the output to a common type. The transformation calls a
 * {@link CoMapFunction#map1} for each element of the first input and
 * {@link CoMapFunction#map2} for each element of the second input. Each
 * CoMapFunction call returns exactly one element.
 *
 * @param coMapper The CoMapFunction used to jointly transform the two input DataStreams
 * @return The transformed {@link DataStream}
 */
public <R> SingleOutputStreamOperator<R> map(CoMapFunction<IN1, IN2, R> coMapper) {

	TypeInformation<R> outTypeInfo = TypeExtractor.getBinaryOperatorReturnType(
		coMapper,
		CoMapFunction.class,
		0,
		1,
		2,
		TypeExtractor.NO_INDEX,
		getType1(),
		getType2(),
		Utils.getCallLocationName(),
		true);

	return transform("Co-Map", outTypeInfo, new CoStreamMap<>(inputStream1.clean(coMapper)));

}
 
Example #3
Source File: ConnectedStreams.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Applies a CoMap transformation on a {@link ConnectedStreams} and maps
 * the output to a common type. The transformation calls a
 * {@link CoMapFunction#map1} for each element of the first input and
 * {@link CoMapFunction#map2} for each element of the second input. Each
 * CoMapFunction call returns exactly one element.
 *
 * @param coMapper The CoMapFunction used to jointly transform the two input DataStreams
 * @return The transformed {@link DataStream}
 */
public <R> SingleOutputStreamOperator<R> map(CoMapFunction<IN1, IN2, R> coMapper) {

	TypeInformation<R> outTypeInfo = TypeExtractor.getBinaryOperatorReturnType(
		coMapper,
		CoMapFunction.class,
		0,
		1,
		2,
		TypeExtractor.NO_INDEX,
		getType1(),
		getType2(),
		Utils.getCallLocationName(),
		true);

	return map(coMapper, outTypeInfo);
}
 
Example #4
Source File: CoStreamMap.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public CoStreamMap(CoMapFunction<IN1, IN2, OUT> mapper) {
	super(mapper);
}
 
Example #5
Source File: CoStreamMap.java    From flink with Apache License 2.0 4 votes vote down vote up
public CoStreamMap(CoMapFunction<IN1, IN2, OUT> mapper) {
	super(mapper);
}
 
Example #6
Source File: TwoInputStreamTaskTest.java    From flink with Apache License 2.0 4 votes vote down vote up
public AnyReadingCoStreamMap(CoMapFunction<IN1, IN2, OUT> mapper) {
	super(mapper);
}
 
Example #7
Source File: CoStreamMap.java    From flink with Apache License 2.0 4 votes vote down vote up
public CoStreamMap(CoMapFunction<IN1, IN2, OUT> mapper) {
	super(mapper);
}
 
Example #8
Source File: ConnectedStreams.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Applies a CoMap transformation on a {@link ConnectedStreams} and maps
 * the output to a common type. The transformation calls a
 * {@link CoMapFunction#map1} for each element of the first input and
 * {@link CoMapFunction#map2} for each element of the second input. Each
 * CoMapFunction call returns exactly one element.
 *
 * @param coMapper The CoMapFunction used to jointly transform the two input DataStreams
 * @param outputType {@link TypeInformation} for the result type of the function.
 * @return The transformed {@link DataStream}
 */
public <R> SingleOutputStreamOperator<R> map(CoMapFunction<IN1, IN2, R> coMapper, TypeInformation<R> outputType) {
	return transform("Co-Map", outputType, new CoStreamMap<>(inputStream1.clean(coMapper)));
}