Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a keyed stream become not keyed after a process function?

Suppose I get a stream after a keyed process.

DataStream<T> stream= sourceStream.keyBy(key).window(window).apply(function);

Is the resulting stream still keyed? Can I use some Keyed state in that stream?

like image 501
haoyu wang Avatar asked Mar 11 '26 18:03

haoyu wang


1 Answers

That's correct, the output of a keyed window or a keyed process function is no longer a keyed stream. Flink has no way of knowing whether the computation you have performed will have preserved the partitioning that was in place beforehand.

To use keyed state, you will need to either re-key the stream, or if you are certain that the original keying has been preserved, you can use reinterpretAsKeyedStream to inform Flink that the stream is still keyed.

like image 74
David Anderson Avatar answered Mar 14 '26 00:03

David Anderson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!