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, Sink<T> sink, TypeInformation<T> typeInformation)
Add sink operator to the input stream.static <T,R,K>
OneInputTransformation<T,R>getOneInputKeyedTransformation(String operatorName, AbstractDataStream<T> inputStream, TypeInformation<R> outTypeInformation, OneInputStreamOperator<T,R> operator, KeySelector<T,K> keySelector, TypeInformation<K> keyType)
Construct and return aOneInputTransformation
from keyed input streams.static <T,R>
OneInputTransformation<T,R>getOneInputTransformation(String operatorName, AbstractDataStream<T> inputStream, TypeInformation<R> outTypeInformation, OneInputStreamOperator<T,R> operator)
Construct and return aOneInputTransformation
from non-keyed input streams.static <IN,OUT>
TypeInformation<OUT>getOutputTypeForOneInputProcessFunction(OneInputStreamProcessFunction<IN,OUT> processFunction, TypeInformation<IN> inTypeInformation)
Get the output type information forOneInputStreamProcessFunction
from input type information.static <IN1,IN2,OUT>
TypeInformation<OUT>getOutputTypeForTwoInputBroadcastProcessFunction(TwoInputBroadcastStreamProcessFunction<IN1,IN2,OUT> processFunction, TypeInformation<IN1> in1TypeInformation, TypeInformation<IN2> in2TypeInformation)
Get the output type information forTwoInputBroadcastStreamProcessFunction
from two input type information .static <IN1,IN2,OUT>
TypeInformation<OUT>getOutputTypeForTwoInputNonBroadcastProcessFunction(TwoInputNonBroadcastStreamProcessFunction<IN1,IN2,OUT> processFunction, TypeInformation<IN1> in1TypeInformation, TypeInformation<IN2> in2TypeInformation)
Get the output type information forTwoInputNonBroadcastStreamProcessFunction
from two input type information .static <IN,OUT1,OUT2>
Tuple2<TypeInformation<OUT1>,TypeInformation<OUT2>>getOutputTypesForTwoOutputProcessFunction(TwoOutputStreamProcessFunction<IN,OUT1,OUT2> twoOutputStreamProcessFunction, TypeInformation<IN> inTypeInformation)
Get output types information forTwoOutputStreamProcessFunction
from the input type information.static <IN1,IN2,OUT>
TwoInputTransformation<IN1,IN2,OUT>getTwoInputTransformation(String operatorName, AbstractDataStream<IN1> inputStream1, AbstractDataStream<IN2> inputStream2, TypeInformation<OUT> outTypeInformation, TwoInputStreamOperator<IN1,IN2,OUT> operator)
Construct and return aTwoInputTransformation
from two input streams.static <T,R>
AbstractDataStream<R>transformOneInputOperator(String operatorName, AbstractDataStream<T> inputStream, TypeInformation<R> outTypeInfo, StreamOperatorFactory<R> operatorFactory)
Construct and return a new DataStream with one input operator.static void
validateStates(Set<StateDeclaration> inputStateDeclarations, Set<StateDeclaration.RedistributionMode> invalidStateDeclarations)
Wrap aGlobalStreamImpl
with configure handle.static <T> GlobalStream.ProcessConfigurableAndGlobalStream<T>
wrapWithConfigureHandle(GlobalStreamImpl<T> stream)
Wrap aGlobalStreamImpl
with configure handle.static <K,T>
KeyedPartitionStream.ProcessConfigurableAndKeyedPartitionStream<K,T>wrapWithConfigureHandle(KeyedPartitionStreamImpl<K,T> stream)
Wrap aKeyedPartitionStreamImpl
with configure handle.static <T> NonKeyedPartitionStream.ProcessConfigurableAndNonKeyedPartitionStream<T>
wrapWithConfigureHandle(NonKeyedPartitionStreamImpl<T> stream)
Wrap aNonKeyedPartitionStreamImpl
with configure handle.
-
-
-
Method Detail
-
getOutputTypeForOneInputProcessFunction
public static <IN,OUT> TypeInformation<OUT> getOutputTypeForOneInputProcessFunction(OneInputStreamProcessFunction<IN,OUT> processFunction, TypeInformation<IN> inTypeInformation)
Get the output type information forOneInputStreamProcessFunction
from input type information.
-
getOutputTypeForTwoInputNonBroadcastProcessFunction
public static <IN1,IN2,OUT> TypeInformation<OUT> getOutputTypeForTwoInputNonBroadcastProcessFunction(TwoInputNonBroadcastStreamProcessFunction<IN1,IN2,OUT> processFunction, TypeInformation<IN1> in1TypeInformation, TypeInformation<IN2> in2TypeInformation)
Get the output type information forTwoInputNonBroadcastStreamProcessFunction
from two input type information .
-
getOutputTypeForTwoInputBroadcastProcessFunction
public static <IN1,IN2,OUT> TypeInformation<OUT> getOutputTypeForTwoInputBroadcastProcessFunction(TwoInputBroadcastStreamProcessFunction<IN1,IN2,OUT> processFunction, TypeInformation<IN1> in1TypeInformation, TypeInformation<IN2> in2TypeInformation)
Get the output type information forTwoInputBroadcastStreamProcessFunction
from two input type information .
-
getOutputTypesForTwoOutputProcessFunction
public static <IN,OUT1,OUT2> Tuple2<TypeInformation<OUT1>,TypeInformation<OUT2>> getOutputTypesForTwoOutputProcessFunction(TwoOutputStreamProcessFunction<IN,OUT1,OUT2> twoOutputStreamProcessFunction, TypeInformation<IN> inTypeInformation)
Get output types information forTwoOutputStreamProcessFunction
from the input type information.
-
getOneInputTransformation
public static <T,R> OneInputTransformation<T,R> getOneInputTransformation(String operatorName, AbstractDataStream<T> inputStream, TypeInformation<R> outTypeInformation, OneInputStreamOperator<T,R> operator)
Construct and return aOneInputTransformation
from non-keyed input streams.
-
getOneInputKeyedTransformation
public static <T,R,K> OneInputTransformation<T,R> getOneInputKeyedTransformation(String operatorName, AbstractDataStream<T> inputStream, TypeInformation<R> outTypeInformation, OneInputStreamOperator<T,R> operator, KeySelector<T,K> keySelector, TypeInformation<K> keyType)
Construct and return aOneInputTransformation
from keyed input streams.
-
getTwoInputTransformation
public static <IN1,IN2,OUT> TwoInputTransformation<IN1,IN2,OUT> getTwoInputTransformation(String operatorName, AbstractDataStream<IN1> inputStream1, AbstractDataStream<IN2> inputStream2, TypeInformation<OUT> outTypeInformation, TwoInputStreamOperator<IN1,IN2,OUT> operator)
Construct and return aTwoInputTransformation
from two input streams.
-
transformOneInputOperator
public static <T,R> AbstractDataStream<R> transformOneInputOperator(String operatorName, AbstractDataStream<T> inputStream, TypeInformation<R> outTypeInfo, StreamOperatorFactory<R> operatorFactory)
Construct and return a new DataStream with one input operator.
-
addSinkOperator
public static <T> DataStreamV2SinkTransformation<T,T> addSinkOperator(AbstractDataStream<T> inputStream, Sink<T> sink, TypeInformation<T> typeInformation)
Add sink operator to the input stream.
-
wrapWithConfigureHandle
public static <T> NonKeyedPartitionStream.ProcessConfigurableAndNonKeyedPartitionStream<T> wrapWithConfigureHandle(NonKeyedPartitionStreamImpl<T> stream)
Wrap aNonKeyedPartitionStreamImpl
with configure handle.
-
wrapWithConfigureHandle
public static <K,T> KeyedPartitionStream.ProcessConfigurableAndKeyedPartitionStream<K,T> wrapWithConfigureHandle(KeyedPartitionStreamImpl<K,T> stream)
Wrap aKeyedPartitionStreamImpl
with configure handle.
-
wrapWithConfigureHandle
public static <T> GlobalStream.ProcessConfigurableAndGlobalStream<T> wrapWithConfigureHandle(GlobalStreamImpl<T> stream)
Wrap aGlobalStreamImpl
with configure handle.
-
validateStates
public static void validateStates(Set<StateDeclaration> inputStateDeclarations, Set<StateDeclaration.RedistributionMode> invalidStateDeclarations)
Wrap aGlobalStreamImpl
with configure handle.
-
-