Java Code Examples for org.apache.flink.api.java.typeutils.TypeExtractor#getMapReturnTypes()

The following examples show how to use org.apache.flink.api.java.typeutils.TypeExtractor#getMapReturnTypes() . 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: DataSet.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
/**
 * Applies a Map transformation on this DataSet.
 *
 * <p>The transformation calls a {@link org.apache.flink.api.common.functions.MapFunction} for each element of the DataSet.
 * Each MapFunction call returns exactly one element.
 *
 * @param mapper The MapFunction that is called for each element of the DataSet.
 * @return A MapOperator that represents the transformed DataSet.
 *
 * @see org.apache.flink.api.common.functions.MapFunction
 * @see org.apache.flink.api.common.functions.RichMapFunction
 * @see MapOperator
 */
public <R> MapOperator<T, R> map(MapFunction<T, R> mapper) {
	if (mapper == null) {
		throw new NullPointerException("Map function must not be null.");
	}

	String callLocation = Utils.getCallLocationName();
	TypeInformation<R> resultType = TypeExtractor.getMapReturnTypes(mapper, getType(), callLocation, true);
	return new MapOperator<>(this, resultType, clean(mapper), callLocation);
}
 
Example 2
Source File: DataStream.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
/**
 * Applies a Map transformation on a {@link DataStream}. The transformation
 * calls a {@link MapFunction} for each element of the DataStream. Each
 * MapFunction call returns exactly one element. The user can also extend
 * {@link RichMapFunction} to gain access to other features provided by the
 * {@link org.apache.flink.api.common.functions.RichFunction} interface.
 *
 * @param mapper
 *            The MapFunction that is called for each element of the
 *            DataStream.
 * @param <R>
 *            output type
 * @return The transformed {@link DataStream}.
 */
public <R> SingleOutputStreamOperator<R> map(MapFunction<T, R> mapper) {

	TypeInformation<R> outType = TypeExtractor.getMapReturnTypes(clean(mapper), getType(),
			Utils.getCallLocationName(), true);

	return transform("Map", outType, new StreamMap<>(clean(mapper)));
}
 
Example 3
Source File: DataSet.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Applies a Map transformation on this DataSet.
 *
 * <p>The transformation calls a {@link org.apache.flink.api.common.functions.MapFunction} for each element of the DataSet.
 * Each MapFunction call returns exactly one element.
 *
 * @param mapper The MapFunction that is called for each element of the DataSet.
 * @return A MapOperator that represents the transformed DataSet.
 *
 * @see org.apache.flink.api.common.functions.MapFunction
 * @see org.apache.flink.api.common.functions.RichMapFunction
 * @see MapOperator
 */
public <R> MapOperator<T, R> map(MapFunction<T, R> mapper) {
	if (mapper == null) {
		throw new NullPointerException("Map function must not be null.");
	}

	String callLocation = Utils.getCallLocationName();
	TypeInformation<R> resultType = TypeExtractor.getMapReturnTypes(mapper, getType(), callLocation, true);
	return new MapOperator<>(this, resultType, clean(mapper), callLocation);
}
 
Example 4
Source File: DataStream.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Applies a Map transformation on a {@link DataStream}. The transformation
 * calls a {@link MapFunction} for each element of the DataStream. Each
 * MapFunction call returns exactly one element. The user can also extend
 * {@link RichMapFunction} to gain access to other features provided by the
 * {@link org.apache.flink.api.common.functions.RichFunction} interface.
 *
 * @param mapper
 *            The MapFunction that is called for each element of the
 *            DataStream.
 * @param <R>
 *            output type
 * @return The transformed {@link DataStream}.
 */
public <R> SingleOutputStreamOperator<R> map(MapFunction<T, R> mapper) {

	TypeInformation<R> outType = TypeExtractor.getMapReturnTypes(clean(mapper), getType(),
			Utils.getCallLocationName(), true);

	return transform("Map", outType, new StreamMap<>(clean(mapper)));
}
 
Example 5
Source File: DataSet.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Applies a Map transformation on this DataSet.
 *
 * <p>The transformation calls a {@link org.apache.flink.api.common.functions.MapFunction} for each element of the DataSet.
 * Each MapFunction call returns exactly one element.
 *
 * @param mapper The MapFunction that is called for each element of the DataSet.
 * @return A MapOperator that represents the transformed DataSet.
 *
 * @see org.apache.flink.api.common.functions.MapFunction
 * @see org.apache.flink.api.common.functions.RichMapFunction
 * @see MapOperator
 */
public <R> MapOperator<T, R> map(MapFunction<T, R> mapper) {
	if (mapper == null) {
		throw new NullPointerException("Map function must not be null.");
	}

	String callLocation = Utils.getCallLocationName();
	TypeInformation<R> resultType = TypeExtractor.getMapReturnTypes(mapper, getType(), callLocation, true);
	return new MapOperator<>(this, resultType, clean(mapper), callLocation);
}
 
Example 6
Source File: DataStream.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Applies a Map transformation on a {@link DataStream}. The transformation
 * calls a {@link MapFunction} for each element of the DataStream. Each
 * MapFunction call returns exactly one element. The user can also extend
 * {@link RichMapFunction} to gain access to other features provided by the
 * {@link org.apache.flink.api.common.functions.RichFunction} interface.
 *
 * @param mapper
 *            The MapFunction that is called for each element of the
 *            DataStream.
 * @param <R>
 *            output type
 * @return The transformed {@link DataStream}.
 */
public <R> SingleOutputStreamOperator<R> map(MapFunction<T, R> mapper) {

	TypeInformation<R> outType = TypeExtractor.getMapReturnTypes(clean(mapper), getType(),
			Utils.getCallLocationName(), true);

	return map(mapper, outType);
}