Class StreamUtils
- java.lang.Object
-
- org.apache.flink.datastream.impl.utils.StreamUtils
-
public final class StreamUtils extends Object
This class encapsulates the common logic for all type of streams. It can be used to handle things like extract type information, create a new transformation and so on for AbstractDataStream.
-
-
Constructor Summary
Constructors Constructor Description StreamUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> DataStreamV2SinkTransformation<T,T>addSinkOperator(AbstractDataStream<T> inputStream, org.apache.flink.api.connector.dsv2.Sink<T> sink, org.apache.flink.api.common.typeinfo.TypeInformation<T> typeInformation)Add sink operator to the input stream.static <T,R,K>
org.apache.flink.streaming.api.transformations.OneInputTransformation<T,R>getOneInputKeyedTransformation(String operatorName, AbstractDataStream<T> inputStream, org.apache.flink.api.common.typeinfo.TypeInformation<R> outTypeInformation, org.apache.flink.streaming.api.operators.OneInputStreamOperator<T,R> operator, org.apache.flink.api.java.functions.KeySelector<T,K> keySelector, org.apache.flink.api.common.typeinfo.TypeInformation<K> keyType)Construct and return aOneInputTransformationfrom keyed input streams.static <T,R>
org.apache.flink.streaming.api.transformations.OneInputTransformation<T,R>getOneInputTransformation(String operatorName, AbstractDataStream<T> inputStream, org.apache.flink.api.common.typeinfo.TypeInformation<R> outTypeInformation, org.apache.flink.streaming.api.operators.OneInputStreamOperator<T,R> operator)Construct and return aOneInputTransformationfrom non-keyed input streams.static <IN,OUT>
org.apache.flink.api.common.typeinfo.TypeInformation<OUT>getOutputTypeForOneInputProcessFunction(org.apache.flink.datastream.api.function.OneInputStreamProcessFunction<IN,OUT> processFunction, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInformation)Get the output type information forOneInputStreamProcessFunctionfrom input type information.static <IN1,IN2,OUT>
org.apache.flink.api.common.typeinfo.TypeInformation<OUT>getOutputTypeForTwoInputBroadcastProcessFunction(org.apache.flink.datastream.api.function.TwoInputBroadcastStreamProcessFunction<IN1,IN2,OUT> processFunction, org.apache.flink.api.common.typeinfo.TypeInformation<IN1> in1TypeInformation, org.apache.flink.api.common.typeinfo.TypeInformation<IN2> in2TypeInformation)Get the output type information forTwoInputBroadcastStreamProcessFunctionfrom two input type information .static <IN1,IN2,OUT>
org.apache.flink.api.common.typeinfo.TypeInformation<OUT>getOutputTypeForTwoInputNonBroadcastProcessFunction(org.apache.flink.datastream.api.function.TwoInputNonBroadcastStreamProcessFunction<IN1,IN2,OUT> processFunction, org.apache.flink.api.common.typeinfo.TypeInformation<IN1> in1TypeInformation, org.apache.flink.api.common.typeinfo.TypeInformation<IN2> in2TypeInformation)Get the output type information forTwoInputNonBroadcastStreamProcessFunctionfrom two input type information .static <IN,OUT1,OUT2>
org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.api.common.typeinfo.TypeInformation<OUT1>,org.apache.flink.api.common.typeinfo.TypeInformation<OUT2>>getOutputTypesForTwoOutputProcessFunction(org.apache.flink.datastream.api.function.TwoOutputStreamProcessFunction<IN,OUT1,OUT2> twoOutputStreamProcessFunction, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInformation)Get output types information forTwoOutputStreamProcessFunctionfrom the input type information.static <IN1,IN2,OUT>
org.apache.flink.streaming.api.transformations.TwoInputTransformation<IN1,IN2,OUT>getTwoInputTransformation(String operatorName, AbstractDataStream<IN1> inputStream1, AbstractDataStream<IN2> inputStream2, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInformation, org.apache.flink.streaming.api.operators.TwoInputStreamOperator<IN1,IN2,OUT> operator)Construct and return aTwoInputTransformationfrom two input streams.static <T,R>
AbstractDataStream<R>transformOneInputOperator(String operatorName, AbstractDataStream<T> inputStream, org.apache.flink.api.common.typeinfo.TypeInformation<R> outTypeInfo, org.apache.flink.streaming.api.operators.StreamOperatorFactory<R> operatorFactory)Construct and return a new DataStream with one input operator.static voidvalidateStates(Set<org.apache.flink.api.common.state.StateDeclaration> inputStateDeclarations, Set<org.apache.flink.api.common.state.StateDeclaration.RedistributionMode> invalidStateDeclarations)Wrap aGlobalStreamImplwith configure handle.static <T> org.apache.flink.datastream.api.stream.GlobalStream.ProcessConfigurableAndGlobalStream<T>wrapWithConfigureHandle(GlobalStreamImpl<T> stream)Wrap aGlobalStreamImplwith configure handle.static <K,T>
org.apache.flink.datastream.api.stream.KeyedPartitionStream.ProcessConfigurableAndKeyedPartitionStream<K,T>wrapWithConfigureHandle(KeyedPartitionStreamImpl<K,T> stream)Wrap aKeyedPartitionStreamImplwith configure handle.static <T> org.apache.flink.datastream.api.stream.NonKeyedPartitionStream.ProcessConfigurableAndNonKeyedPartitionStream<T>wrapWithConfigureHandle(NonKeyedPartitionStreamImpl<T> stream)Wrap aNonKeyedPartitionStreamImplwith configure handle.
-
-
-
Method Detail
-
getOutputTypeForOneInputProcessFunction
public static <IN,OUT> org.apache.flink.api.common.typeinfo.TypeInformation<OUT> getOutputTypeForOneInputProcessFunction(org.apache.flink.datastream.api.function.OneInputStreamProcessFunction<IN,OUT> processFunction, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInformation)Get the output type information forOneInputStreamProcessFunctionfrom input type information.
-
getOutputTypeForTwoInputNonBroadcastProcessFunction
public static <IN1,IN2,OUT> org.apache.flink.api.common.typeinfo.TypeInformation<OUT> getOutputTypeForTwoInputNonBroadcastProcessFunction(org.apache.flink.datastream.api.function.TwoInputNonBroadcastStreamProcessFunction<IN1,IN2,OUT> processFunction, org.apache.flink.api.common.typeinfo.TypeInformation<IN1> in1TypeInformation, org.apache.flink.api.common.typeinfo.TypeInformation<IN2> in2TypeInformation)Get the output type information forTwoInputNonBroadcastStreamProcessFunctionfrom two input type information .
-
getOutputTypeForTwoInputBroadcastProcessFunction
public static <IN1,IN2,OUT> org.apache.flink.api.common.typeinfo.TypeInformation<OUT> getOutputTypeForTwoInputBroadcastProcessFunction(org.apache.flink.datastream.api.function.TwoInputBroadcastStreamProcessFunction<IN1,IN2,OUT> processFunction, org.apache.flink.api.common.typeinfo.TypeInformation<IN1> in1TypeInformation, org.apache.flink.api.common.typeinfo.TypeInformation<IN2> in2TypeInformation)Get the output type information forTwoInputBroadcastStreamProcessFunctionfrom two input type information .
-
getOutputTypesForTwoOutputProcessFunction
public static <IN,OUT1,OUT2> org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.api.common.typeinfo.TypeInformation<OUT1>,org.apache.flink.api.common.typeinfo.TypeInformation<OUT2>> getOutputTypesForTwoOutputProcessFunction(org.apache.flink.datastream.api.function.TwoOutputStreamProcessFunction<IN,OUT1,OUT2> twoOutputStreamProcessFunction, org.apache.flink.api.common.typeinfo.TypeInformation<IN> inTypeInformation)Get output types information forTwoOutputStreamProcessFunctionfrom the input type information.
-
getOneInputTransformation
public static <T,R> org.apache.flink.streaming.api.transformations.OneInputTransformation<T,R> getOneInputTransformation(String operatorName, AbstractDataStream<T> inputStream, org.apache.flink.api.common.typeinfo.TypeInformation<R> outTypeInformation, org.apache.flink.streaming.api.operators.OneInputStreamOperator<T,R> operator)
Construct and return aOneInputTransformationfrom non-keyed input streams.
-
getOneInputKeyedTransformation
public static <T,R,K> org.apache.flink.streaming.api.transformations.OneInputTransformation<T,R> getOneInputKeyedTransformation(String operatorName, AbstractDataStream<T> inputStream, org.apache.flink.api.common.typeinfo.TypeInformation<R> outTypeInformation, org.apache.flink.streaming.api.operators.OneInputStreamOperator<T,R> operator, org.apache.flink.api.java.functions.KeySelector<T,K> keySelector, org.apache.flink.api.common.typeinfo.TypeInformation<K> keyType)
Construct and return aOneInputTransformationfrom keyed input streams.
-
getTwoInputTransformation
public static <IN1,IN2,OUT> org.apache.flink.streaming.api.transformations.TwoInputTransformation<IN1,IN2,OUT> getTwoInputTransformation(String operatorName, AbstractDataStream<IN1> inputStream1, AbstractDataStream<IN2> inputStream2, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInformation, org.apache.flink.streaming.api.operators.TwoInputStreamOperator<IN1,IN2,OUT> operator)
Construct and return aTwoInputTransformationfrom two input streams.
-
transformOneInputOperator
public static <T,R> AbstractDataStream<R> transformOneInputOperator(String operatorName, AbstractDataStream<T> inputStream, org.apache.flink.api.common.typeinfo.TypeInformation<R> outTypeInfo, org.apache.flink.streaming.api.operators.StreamOperatorFactory<R> operatorFactory)
Construct and return a new DataStream with one input operator.
-
addSinkOperator
public static <T> DataStreamV2SinkTransformation<T,T> addSinkOperator(AbstractDataStream<T> inputStream, org.apache.flink.api.connector.dsv2.Sink<T> sink, org.apache.flink.api.common.typeinfo.TypeInformation<T> typeInformation)
Add sink operator to the input stream.
-
wrapWithConfigureHandle
public static <T> org.apache.flink.datastream.api.stream.NonKeyedPartitionStream.ProcessConfigurableAndNonKeyedPartitionStream<T> wrapWithConfigureHandle(NonKeyedPartitionStreamImpl<T> stream)
Wrap aNonKeyedPartitionStreamImplwith configure handle.
-
wrapWithConfigureHandle
public static <K,T> org.apache.flink.datastream.api.stream.KeyedPartitionStream.ProcessConfigurableAndKeyedPartitionStream<K,T> wrapWithConfigureHandle(KeyedPartitionStreamImpl<K,T> stream)
Wrap aKeyedPartitionStreamImplwith configure handle.
-
wrapWithConfigureHandle
public static <T> org.apache.flink.datastream.api.stream.GlobalStream.ProcessConfigurableAndGlobalStream<T> wrapWithConfigureHandle(GlobalStreamImpl<T> stream)
Wrap aGlobalStreamImplwith configure handle.
-
validateStates
public static void validateStates(Set<org.apache.flink.api.common.state.StateDeclaration> inputStateDeclarations, Set<org.apache.flink.api.common.state.StateDeclaration.RedistributionMode> invalidStateDeclarations)
Wrap aGlobalStreamImplwith configure handle.
-
-