Hi Jiazhi
Keyed state is only supported in keyed stream as it needs key selector and key serializer to select specific key from the input element, this is correct.
If you dig into Flink code, the keyed state backend would only be created when the operator has its own serializer[1].
After 'keyBy' to transform data stream to keyed stream, you can use the keyed state in the following operator. And the following operator is not limited to only operator with "keyed" prefix.
For ProcessAllWindowFunction, we need to use it with windowAll transformation [2] and windowAll actually includes keyBy actions if takeing a look at the code[3].
For ProcessWindowFunction, we must use keyBy first and then use next window transformation.
Hope this explanation could help you.
Best
Yun Tang
Deal all
Keyed state (ValueState, ReducingState, ListState, AggregatingState, MapState)
Supported in Keyed Stream, meaning only in KeyedProcessFunction? But in practice, I can also use these states in ProcessAllWindowFunction and ProcessWindowFunction. Why?
thank you
jiazhi