private static <IN, OUT> TypeInformation<OUT> getAllWindowFunctionReturnType( AllWindowFunction<IN, OUT, ?> function, TypeInformation<IN> inType) { return TypeExtractor.getUnaryOperatorReturnType( function, AllWindowFunction.class, 0, 1, new int[]{2, 0}, inType, null, false); }
private static <IN, OUT> TypeInformation<OUT> getProcessAllWindowFunctionReturnType( ProcessAllWindowFunction<IN, OUT, ?> function, TypeInformation<IN> inType) { return TypeExtractor.getUnaryOperatorReturnType( function, ProcessAllWindowFunction.class, 0, 1, TypeExtractor.NO_INDEX, inType, null, false); }
private static <IN, OUT, KEY> TypeInformation<OUT> getWindowFunctionReturnType( WindowFunction<IN, OUT, KEY, ?> function, TypeInformation<IN> inType) { return TypeExtractor.getUnaryOperatorReturnType( function, WindowFunction.class, 0, 1, new int[]{3, 0}, inType, null, false); }
private static <IN, OUT, KEY> TypeInformation<OUT> getProcessWindowFunctionReturnType( ProcessWindowFunction<IN, OUT, KEY, ?> function, TypeInformation<IN> inType, String functionName) { return TypeExtractor.getUnaryOperatorReturnType( function, ProcessWindowFunction.class, 0, 1, TypeExtractor.NO_INDEX, inType, functionName, false); }
@PublicEvolving public static <IN, OUT> TypeInformation<OUT> getMapReturnTypes(MapFunction<IN, OUT> mapInterface, TypeInformation<IN> inType, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType( (Function) mapInterface, MapFunction.class, 0, 1, NO_INDEX, inType, functionName, allowMissing); }
@PublicEvolving public static <IN, OUT> TypeInformation<OUT> getFlatMapReturnTypes(FlatMapFunction<IN, OUT> flatMapInterface, TypeInformation<IN> inType, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType( (Function) flatMapInterface, FlatMapFunction.class, 0, 1, new int[]{1, 0}, inType, functionName, allowMissing); }
@PublicEvolving public static <IN, OUT> TypeInformation<OUT> getMapPartitionReturnTypes(MapPartitionFunction<IN, OUT> mapPartitionInterface, TypeInformation<IN> inType, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType( (Function) mapPartitionInterface, MapPartitionFunction.class, 0, 1, new int[]{1, 0}, inType, functionName, allowMissing); }
@PublicEvolving public static <IN, OUT> TypeInformation<OUT> getGroupReduceReturnTypes(GroupReduceFunction<IN, OUT> groupReduceInterface, TypeInformation<IN> inType, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType( (Function) groupReduceInterface, GroupReduceFunction.class, 0, 1, new int[]{1, 0}, inType, functionName, allowMissing); }
@PublicEvolving public static <IN, OUT> TypeInformation<OUT> getKeySelectorTypes(KeySelector<IN, OUT> selectorInterface, TypeInformation<IN> inType, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType( (Function) selectorInterface, KeySelector.class, 0, 1, NO_INDEX, inType, functionName, allowMissing); }
@PublicEvolving public static <IN, OUT> TypeInformation<OUT> getGroupCombineReturnTypes(GroupCombineFunction<IN, OUT> combineInterface, TypeInformation<IN> inType, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType( (Function) combineInterface, GroupCombineFunction.class, 0, 1, new int[]{1, 0}, inType, functionName, allowMissing); }
/** * @deprecated will be removed in a future version */ @PublicEvolving @Deprecated public static <IN, OUT> TypeInformation<OUT> getFoldReturnTypes(FoldFunction<IN, OUT> foldInterface, TypeInformation<IN> inType, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType( (Function) foldInterface, FoldFunction.class, 0, 1, NO_INDEX, inType, functionName, allowMissing); }
@PublicEvolving public static <IN, OUT> TypeInformation<OUT> getAggregateFunctionReturnType( AggregateFunction<IN, ?, OUT> function, TypeInformation<IN> inType, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType( function, AggregateFunction.class, 0, 2, NO_INDEX, inType, functionName, allowMissing); }
@PublicEvolving public static <IN, ACC> TypeInformation<ACC> getAggregateFunctionAccumulatorType( AggregateFunction<IN, ACC, ?> function, TypeInformation<IN> inType, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType( function, AggregateFunction.class, 0, 1, NO_INDEX, inType, functionName, allowMissing); }
/** * Applies a flat select function to the detected pattern sequence. For each pattern sequence * the provided {@link PatternFlatSelectFunction} is called. The pattern flat select function * can produce an arbitrary number of resulting elements. * * @param patternFlatSelectFunction The pattern flat select function which is called for each * detected pattern sequence. * @param <R> Type of the resulting elements * @return {@link DataStream} which contains the resulting elements from the pattern flat select * function. */ public <R> SingleOutputStreamOperator<R> flatSelect(final PatternFlatSelectFunction<T, R> patternFlatSelectFunction) { // we have to extract the output type from the provided pattern selection function manually // because the TypeExtractor cannot do that if the method is wrapped in a MapFunction final TypeInformation<R> outTypeInfo = TypeExtractor.getUnaryOperatorReturnType( patternFlatSelectFunction, PatternFlatSelectFunction.class, 0, 1, new int[]{1, 0}, builder.getInputType(), null, false); return flatSelect(patternFlatSelectFunction, outTypeInfo); }
/** * Applies a process function to the detected pattern sequence. For each pattern sequence the * provided {@link PatternProcessFunction} is called. In order to process timed out partial matches as well one can * use {@link TimedOutPartialMatchHandler} as additional interface. * * @param patternProcessFunction The pattern process function which is called for each detected * pattern sequence. * @param <R> Type of the resulting elements * @return {@link DataStream} which contains the resulting elements from the pattern process * function. */ public <R> SingleOutputStreamOperator<R> process(final PatternProcessFunction<T, R> patternProcessFunction) { final TypeInformation<R> returnType = TypeExtractor.getUnaryOperatorReturnType( patternProcessFunction, PatternProcessFunction.class, 0, 1, TypeExtractor.NO_INDEX, builder.getInputType(), null, false); return process(patternProcessFunction, returnType); }
/** * Applies a select function to the detected pattern sequence. For each pattern sequence the * provided {@link PatternSelectFunction} is called. The pattern select function can produce * exactly one resulting element. * * @param patternSelectFunction The pattern select function which is called for each detected * pattern sequence. * @param <R> Type of the resulting elements * @return {@link DataStream} which contains the resulting elements from the pattern select * function. */ public <R> SingleOutputStreamOperator<R> select(final PatternSelectFunction<T, R> patternSelectFunction) { // we have to extract the output type from the provided pattern selection function manually // because the TypeExtractor cannot do that if the method is wrapped in a MapFunction final TypeInformation<R> returnType = TypeExtractor.getUnaryOperatorReturnType( patternSelectFunction, PatternSelectFunction.class, 0, 1, TypeExtractor.NO_INDEX, builder.getInputType(), null, false); return select(patternSelectFunction, returnType); }
@PublicEvolving public static <T> TypeInformation<T> getPartitionerTypes( Partitioner<T> partitioner, String functionName, boolean allowMissing) { return getUnaryOperatorReturnType( partitioner, Partitioner.class, -1, 0, new int[]{0}, null, functionName, allowMissing); }
/** * Applies the given {@link ProcessFunction} on the input stream, thereby * creating a transformed output stream. * * <p>The function will be called for every element in the input streams and can produce zero * or more output elements. * * @param processFunction The {@link ProcessFunction} that is called for each element * in the stream. * * @param <R> The type of elements emitted by the {@code ProcessFunction}. * * @return The transformed {@link DataStream}. */ @PublicEvolving public <R> SingleOutputStreamOperator<R> process(ProcessFunction<T, R> processFunction) { TypeInformation<R> outType = TypeExtractor.getUnaryOperatorReturnType( processFunction, ProcessFunction.class, 0, 1, TypeExtractor.NO_INDEX, getType(), Utils.getCallLocationName(), true); return process(processFunction, outType); }
/** * Applies the given {@link KeyedProcessFunction} on the input stream, thereby creating a transformed output stream. * * <p>The function will be called for every element in the input streams and can produce zero * or more output elements. Contrary to the {@link DataStream#flatMap(FlatMapFunction)} * function, this function can also query the time and set timers. When reacting to the firing * of set timers the function can directly emit elements and/or register yet more timers. * * @param keyedProcessFunction The {@link KeyedProcessFunction} that is called for each element in the stream. * * @param <R> The type of elements emitted by the {@code KeyedProcessFunction}. * * @return The transformed {@link DataStream}. */ @PublicEvolving public <R> SingleOutputStreamOperator<R> process(KeyedProcessFunction<KEY, T, R> keyedProcessFunction) { TypeInformation<R> outType = TypeExtractor.getUnaryOperatorReturnType( keyedProcessFunction, KeyedProcessFunction.class, 1, 2, TypeExtractor.NO_INDEX, getType(), Utils.getCallLocationName(), true); return process(keyedProcessFunction, outType); }
TypeInformation<NEW> newType = TypeExtractor.getUnaryOperatorReturnType( translator, TranslateFunction.class,