Class BroadcastConnectedStream<IN1,IN2>
java.lang.Object
org.apache.flink.streaming.api.datastream.BroadcastConnectedStream<IN1,IN2>
- Type Parameters:
IN1- The input type of the non-broadcast side.IN2- The input type of the broadcast side.
A BroadcastConnectedStream represents the result of connecting a keyed or non-keyed stream, with
a
BroadcastStream with broadcast
state(s). As in the case of ConnectedStreams these streams are useful for cases where
operations on one stream directly affect the operations on the other stream, usually via shared
state between the streams.
An example for the use of such connected streams would be to apply rules that change over time onto another, possibly keyed stream. The stream with the broadcast state has the rules, and will store them in the broadcast state, while the other stream will contain the elements to apply the rules to. By broadcasting the rules, these will be available in all parallel instances, and can be applied to all partitions of the other stream.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBroadcastConnectedStream(StreamExecutionEnvironment env, DataStream<IN1> input1, BroadcastStream<IN2> input2, List<org.apache.flink.api.common.state.MapStateDescriptor<?, ?>> broadcastStateDescriptors) -
Method Summary
Modifier and TypeMethodDescriptionprotected <F> Fclean(F f) Returns the non-broadcastDataStream.Returns theBroadcastStream.org.apache.flink.api.common.typeinfo.TypeInformation<IN1>getType1()Gets the type of the first input.org.apache.flink.api.common.typeinfo.TypeInformation<IN2>getType2()Gets the type of the second input.<OUT> SingleOutputStreamOperator<OUT>process(BroadcastProcessFunction<IN1, IN2, OUT> function) Assumes as inputs aBroadcastStreamand a non-keyedDataStreamand applies the givenBroadcastProcessFunctionon them, thereby creating a transformed output stream.<OUT> SingleOutputStreamOperator<OUT>process(BroadcastProcessFunction<IN1, IN2, OUT> function, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo) Assumes as inputs aBroadcastStreamand a non-keyedDataStreamand applies the givenBroadcastProcessFunctionon them, thereby creating a transformed output stream.<KEY,OUT> SingleOutputStreamOperator<OUT> process(KeyedBroadcastProcessFunction<KEY, IN1, IN2, OUT> function) Assumes as inputs aBroadcastStreamand aKeyedStreamand applies the givenKeyedBroadcastProcessFunctionon them, thereby creating a transformed output stream.<KEY,OUT> SingleOutputStreamOperator<OUT> process(KeyedBroadcastProcessFunction<KEY, IN1, IN2, OUT> function, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo) Assumes as inputs aBroadcastStreamand aKeyedStreamand applies the givenKeyedBroadcastProcessFunctionon them, thereby creating a transformed output stream.
-
Constructor Details
-
BroadcastConnectedStream
protected BroadcastConnectedStream(StreamExecutionEnvironment env, DataStream<IN1> input1, BroadcastStream<IN2> input2, List<org.apache.flink.api.common.state.MapStateDescriptor<?, ?>> broadcastStateDescriptors)
-
-
Method Details
-
getExecutionEnvironment
-
getFirstInput
Returns the non-broadcastDataStream.- Returns:
- The stream which, by convention, is not broadcasted.
-
getSecondInput
Returns theBroadcastStream.- Returns:
- The stream which, by convention, is the broadcast one.
-
getType1
Gets the type of the first input.- Returns:
- The type of the first input
-
getType2
Gets the type of the second input.- Returns:
- The type of the second input
-
process
@PublicEvolving public <KEY,OUT> SingleOutputStreamOperator<OUT> process(KeyedBroadcastProcessFunction<KEY, IN1, IN2, OUT> function) Assumes as inputs aBroadcastStreamand aKeyedStreamand applies the givenKeyedBroadcastProcessFunctionon them, thereby creating a transformed output stream.- Type Parameters:
KEY- The type of the keys in the keyed stream.OUT- The type of the output elements.- Parameters:
function- TheKeyedBroadcastProcessFunctionthat is called for each element in the stream.- Returns:
- The transformed
DataStream.
-
process
@PublicEvolving public <KEY,OUT> SingleOutputStreamOperator<OUT> process(KeyedBroadcastProcessFunction<KEY, IN1, IN2, OUT> function, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo) Assumes as inputs aBroadcastStreamand aKeyedStreamand applies the givenKeyedBroadcastProcessFunctionon them, thereby creating a transformed output stream.- Type Parameters:
KEY- The type of the keys in the keyed stream.OUT- The type of the output elements.- Parameters:
function- TheKeyedBroadcastProcessFunctionthat is called for each element in the stream.outTypeInfo- The type of the output elements.- Returns:
- The transformed
DataStream.
-
process
@PublicEvolving public <OUT> SingleOutputStreamOperator<OUT> process(BroadcastProcessFunction<IN1, IN2, OUT> function) Assumes as inputs aBroadcastStreamand a non-keyedDataStreamand applies the givenBroadcastProcessFunctionon them, thereby creating a transformed output stream.- Type Parameters:
OUT- The type of the output elements.- Parameters:
function- TheBroadcastProcessFunctionthat is called for each element in the stream.- Returns:
- The transformed
DataStream.
-
process
@PublicEvolving public <OUT> SingleOutputStreamOperator<OUT> process(BroadcastProcessFunction<IN1, IN2, OUT> function, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo) Assumes as inputs aBroadcastStreamand a non-keyedDataStreamand applies the givenBroadcastProcessFunctionon them, thereby creating a transformed output stream.- Type Parameters:
OUT- The type of the output elements.- Parameters:
function- TheBroadcastProcessFunctionthat is called for each element in the stream.outTypeInfo- The type of the output elements.- Returns:
- The transformed
DataStream.
-
clean
protected <F> F clean(F f)
-