Big Data_Flink_Java Edition_State Management (3)_Keyed State---Flink Work Note 0062

Then we look at the keyedState, the keyed state, you can see here, the data flowing over, you can see that the above task1, task2 are,

Two parallel subtasks of a task, and then, flowing to task1, there are two keys, one is blue and the other is yellow, then at this time,

In the memory of the subtask task1, the blue state and the yellow state will be stored, and after the data is added later, when the yellow state is

After the data comes back, he can only use the status of the yellow data stored in the memory of task1. That is to say, the corresponding data, after hashing, can only use the status of his own hash value.

The same is true for task2. This process will be automatically managed by flink for us.

      Let's take a look at how many keyed states there are. We can see that the first is the value state. Here we can use the value state, because each data

They are all separated by a key, so of course they can be distinguished by a value state.

      Then there is the list state, because it may also be a set of data, so there may be multiple keys here, there is a list state

Then there is another map state, map State, which represents data as a set of key value pairs

    Then

Guess you like

Origin blog.csdn.net/lidew521/article/details/123548367