问题
I got confused for the difference between "broadcast state" and broadcast() operator, and finally I got the help from a Flink expert in the following thread.
What does it mean that "broadcast state" unblocks the implementation of the “dynamic patterns” feature for Flink’s CEP library?
In the end it seems got the conclusion that "broadcast state" can store the dynamic rules in the keyed stream by RichCoFlatMap , however broadcast() operator cannot, so may I know how "broadcast state" store the dynamic rules by RichCoFlatMap and why broadcast() operator cannot store the dynamic rules by RichCoFlatMap? May I got am example for explaining it?
回答1:
Those are completely two different concepts. Moreover the broadcast()
is kind of a prerequisite for BroadcastState
.
broadcast()
specifies partitioning of data, that says that each element of the stream should be broadcasted to each parallel downstream operator.
BroadcastState
is a state of operator that first of all allows to be read-write from a broadcasted stream and read from non-broadcasted one. Before that there was no way to join such two streams. Moreover this state will ensure that after restore each instance of the state across all parallel instances will be the same.
For more information on the BroadcastState
have look into this docs.
来源:https://stackoverflow.com/questions/50570605/why-broadcast-state-can-store-the-dynamic-rules-however-broadcast-operator-c