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

The following examples show how to use org.apache.flink.api.java.typeutils.TypeExtractor#getFoldReturnTypes() . 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   File: WindowedStream.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Applies the given fold function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the reduce function is
 * interpreted as a regular non-windowed stream.
 *
 * @param function The fold function.
 * @return The data stream that is the result of applying the fold function to the window.
 *
 * @deprecated use {@link #aggregate(AggregationFunction)} instead
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> function) {
	if (function instanceof RichFunction) {
		throw new UnsupportedOperationException("FoldFunction can not be a RichFunction. " +
			"Please use fold(FoldFunction, WindowFunction) instead.");
	}

	TypeInformation<R> resultType = TypeExtractor.getFoldReturnTypes(function, input.getType(),
			Utils.getCallLocationName(), true);

	return fold(initialValue, function, resultType);
}
 
Example 2
Source Project: Flink-CEPplus   File: WindowedStream.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param windowFunction The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction, WindowFunction)} instead
 */
@PublicEvolving
@Deprecated
public <R, ACC> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, ProcessWindowFunction<ACC, R, K, W> windowFunction) {
	if (foldFunction instanceof RichFunction) {
		throw new UnsupportedOperationException("FoldFunction can not be a RichFunction.");
	}

	TypeInformation<ACC> foldResultType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
			Utils.getCallLocationName(), true);

	TypeInformation<R> windowResultType = getProcessWindowFunctionReturnType(windowFunction, foldResultType, Utils.getCallLocationName());

	return fold(initialValue, foldFunction, windowFunction, foldResultType, windowResultType);
}
 
Example 3
Source Project: Flink-CEPplus   File: AllWindowedStream.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Applies the given fold function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the reduce function is
 * interpreted as a regular non-windowed stream.
 *
 * @param function The fold function.
 * @return The data stream that is the result of applying the fold function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction)} instead
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> function) {
	if (function instanceof RichFunction) {
		throw new UnsupportedOperationException("FoldFunction of fold can not be a RichFunction. " +
				"Please use fold(FoldFunction, WindowFunction) instead.");
	}

	TypeInformation<R> resultType = TypeExtractor.getFoldReturnTypes(function, input.getType(),
			Utils.getCallLocationName(), true);

	return fold(initialValue, function, resultType);
}
 
Example 4
Source Project: flink   File: WindowedStream.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Applies the given fold function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the reduce function is
 * interpreted as a regular non-windowed stream.
 *
 * @param function The fold function.
 * @return The data stream that is the result of applying the fold function to the window.
 *
 * @deprecated use {@link #aggregate(AggregationFunction)} instead
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> function) {
	if (function instanceof RichFunction) {
		throw new UnsupportedOperationException("FoldFunction can not be a RichFunction. " +
			"Please use fold(FoldFunction, WindowFunction) instead.");
	}

	TypeInformation<R> resultType = TypeExtractor.getFoldReturnTypes(function, input.getType(),
			Utils.getCallLocationName(), true);

	return fold(initialValue, function, resultType);
}
 
Example 5
Source Project: flink   File: WindowedStream.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param windowFunction The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction, WindowFunction)} instead
 */
@PublicEvolving
@Deprecated
public <R, ACC> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, ProcessWindowFunction<ACC, R, K, W> windowFunction) {
	if (foldFunction instanceof RichFunction) {
		throw new UnsupportedOperationException("FoldFunction can not be a RichFunction.");
	}

	TypeInformation<ACC> foldResultType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
			Utils.getCallLocationName(), true);

	TypeInformation<R> windowResultType = getProcessWindowFunctionReturnType(windowFunction, foldResultType, Utils.getCallLocationName());

	return fold(initialValue, foldFunction, windowFunction, foldResultType, windowResultType);
}
 
Example 6
Source Project: flink   File: WindowedStream.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param windowFunction The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction, WindowFunction)} instead
 */
@PublicEvolving
@Deprecated
public <R, ACC> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, ProcessWindowFunction<ACC, R, K, W> windowFunction) {
	if (foldFunction instanceof RichFunction) {
		throw new UnsupportedOperationException("FoldFunction can not be a RichFunction.");
	}

	TypeInformation<ACC> foldResultType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
			Utils.getCallLocationName(), true);

	TypeInformation<R> windowResultType = getProcessWindowFunctionReturnType(windowFunction, foldResultType, Utils.getCallLocationName());

	return fold(initialValue, foldFunction, windowFunction, foldResultType, windowResultType);
}
 
Example 7
Source Project: flink   File: WindowedStream.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Applies the given fold function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the reduce function is
 * interpreted as a regular non-windowed stream.
 *
 * @param function The fold function.
 * @return The data stream that is the result of applying the fold function to the window.
 *
 * @deprecated use {@link #aggregate(AggregationFunction)} instead
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> function) {
	if (function instanceof RichFunction) {
		throw new UnsupportedOperationException("FoldFunction can not be a RichFunction. " +
			"Please use fold(FoldFunction, WindowFunction) instead.");
	}

	TypeInformation<R> resultType = TypeExtractor.getFoldReturnTypes(function, input.getType(),
			Utils.getCallLocationName(), true);

	return fold(initialValue, function, resultType);
}
 
Example 8
Source Project: Flink-CEPplus   File: WindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction, WindowFunction)} instead
 */
@PublicEvolving
@Deprecated
public <ACC, R> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, WindowFunction<ACC, R, K, W> function) {

	TypeInformation<ACC> foldAccumulatorType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
		Utils.getCallLocationName(), true);

	TypeInformation<R> resultType = getWindowFunctionReturnType(function, foldAccumulatorType);

	return fold(initialValue, foldFunction, function, foldAccumulatorType, resultType);
}
 
Example 9
Source Project: Flink-CEPplus   File: WindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated Use {@link #fold(Object, FoldFunction, WindowFunction)} instead.
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> apply(R initialValue, FoldFunction<T, R> foldFunction, WindowFunction<R, R, K, W> function) {

	TypeInformation<R> resultType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
		Utils.getCallLocationName(), true);

	return apply(initialValue, foldFunction, function, resultType);
}
 
Example 10
Source Project: Flink-CEPplus   File: AllWindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction, ProcessAllWindowFunction)} instead
 */
@PublicEvolving
@Deprecated
public <ACC, R> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, AllWindowFunction<ACC, R, W> function) {

	TypeInformation<ACC> foldAccumulatorType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
		Utils.getCallLocationName(), true);

	TypeInformation<R> resultType = getAllWindowFunctionReturnType(function, foldAccumulatorType);

	return fold(initialValue, foldFunction, function, foldAccumulatorType, resultType);
}
 
Example 11
Source Project: Flink-CEPplus   File: AllWindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction, ProcessAllWindowFunction)} instead
 */
@PublicEvolving
@Deprecated
public <ACC, R> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, ProcessAllWindowFunction<ACC, R, W> function) {

	TypeInformation<ACC> foldAccumulatorType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
		Utils.getCallLocationName(), true);

	TypeInformation<R> resultType = getProcessAllWindowFunctionReturnType(function, foldAccumulatorType);

	return fold(initialValue, foldFunction, function, foldAccumulatorType, resultType);
}
 
Example 12
Source Project: Flink-CEPplus   File: AllWindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated Use {@link #fold(Object, FoldFunction, AllWindowFunction)} instead.
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> apply(R initialValue, FoldFunction<T, R> foldFunction, AllWindowFunction<R, R, W> function) {

	TypeInformation<R> resultType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
			Utils.getCallLocationName(), true);

	return apply(initialValue, foldFunction, function, resultType);
}
 
Example 13
Source Project: Flink-CEPplus   File: KeyedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies a fold transformation on the grouped data stream grouped on by
 * the given key position. The {@link FoldFunction} will receive input
 * values based on the key value. Only input values with the same key will
 * go to the same folder.
 *
 * @param folder
 *            The {@link FoldFunction} that will be called for every element
 *            of the input values with the same key.
 * @param initialValue
 *            The initialValue passed to the folders for each key.
 * @return The transformed DataStream.
 *
 * @deprecated will be removed in a future version
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> folder) {

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

	return transform("Keyed Fold", outType, new StreamGroupedFold<>(clean(folder), initialValue));
}
 
Example 14
Source Project: flink   File: WindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction, WindowFunction)} instead
 */
@PublicEvolving
@Deprecated
public <ACC, R> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, WindowFunction<ACC, R, K, W> function) {

	TypeInformation<ACC> foldAccumulatorType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
		Utils.getCallLocationName(), true);

	TypeInformation<R> resultType = getWindowFunctionReturnType(function, foldAccumulatorType);

	return fold(initialValue, foldFunction, function, foldAccumulatorType, resultType);
}
 
Example 15
Source Project: flink   File: WindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated Use {@link #fold(Object, FoldFunction, WindowFunction)} instead.
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> apply(R initialValue, FoldFunction<T, R> foldFunction, WindowFunction<R, R, K, W> function) {

	TypeInformation<R> resultType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
		Utils.getCallLocationName(), true);

	return apply(initialValue, foldFunction, function, resultType);
}
 
Example 16
Source Project: flink   File: AllWindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction, ProcessAllWindowFunction)} instead
 */
@PublicEvolving
@Deprecated
public <ACC, R> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, AllWindowFunction<ACC, R, W> function) {

	TypeInformation<ACC> foldAccumulatorType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
		Utils.getCallLocationName(), true);

	TypeInformation<R> resultType = getAllWindowFunctionReturnType(function, foldAccumulatorType);

	return fold(initialValue, foldFunction, function, foldAccumulatorType, resultType);
}
 
Example 17
Source Project: flink   File: KeyedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies a fold transformation on the grouped data stream grouped on by
 * the given key position. The {@link FoldFunction} will receive input
 * values based on the key value. Only input values with the same key will
 * go to the same folder.
 *
 * @param folder
 *            The {@link FoldFunction} that will be called for every element
 *            of the input values with the same key.
 * @param initialValue
 *            The initialValue passed to the folders for each key.
 * @return The transformed DataStream.
 *
 * @deprecated will be removed in a future version
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> folder) {

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

	return transform("Keyed Fold", outType, new StreamGroupedFold<>(clean(folder), initialValue));
}
 
Example 18
Source Project: flink   File: AllWindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction, ProcessAllWindowFunction)} instead
 */
@PublicEvolving
@Deprecated
public <ACC, R> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, ProcessAllWindowFunction<ACC, R, W> function) {

	TypeInformation<ACC> foldAccumulatorType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
		Utils.getCallLocationName(), true);

	TypeInformation<R> resultType = getProcessAllWindowFunctionReturnType(function, foldAccumulatorType);

	return fold(initialValue, foldFunction, function, foldAccumulatorType, resultType);
}
 
Example 19
Source Project: flink   File: AllWindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated Use {@link #fold(Object, FoldFunction, AllWindowFunction)} instead.
 */
@Deprecated
public <R> SingleOutputStreamOperator<R> apply(R initialValue, FoldFunction<T, R> foldFunction, AllWindowFunction<R, R, W> function) {

	TypeInformation<R> resultType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
			Utils.getCallLocationName(), true);

	return apply(initialValue, foldFunction, function, resultType);
}
 
Example 20
Source Project: flink   File: WindowedStream.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Applies the given window function to each window. The window function is called for each
 * evaluation of the window for each key individually. The output of the window function is
 * interpreted as a regular non-windowed stream.
 *
 * <p>Arriving data is incrementally aggregated using the given fold function.
 *
 * @param initialValue The initial value of the fold.
 * @param foldFunction The fold function that is used for incremental aggregation.
 * @param function The window function.
 * @return The data stream that is the result of applying the window function to the window.
 *
 * @deprecated use {@link #aggregate(AggregateFunction, WindowFunction)} instead
 */
@PublicEvolving
@Deprecated
public <ACC, R> SingleOutputStreamOperator<R> fold(ACC initialValue, FoldFunction<T, ACC> foldFunction, WindowFunction<ACC, R, K, W> function) {

	TypeInformation<ACC> foldAccumulatorType = TypeExtractor.getFoldReturnTypes(foldFunction, input.getType(),
		Utils.getCallLocationName(), true);

	TypeInformation<R> resultType = getWindowFunctionReturnType(function, foldAccumulatorType);

	return fold(initialValue, foldFunction, function, foldAccumulatorType, resultType);
}