Sliding Count Window Ordering

I’m utilizing a Flink sliding count window (with count 2) with a collect distinct array aggregate to detect when a value changes. If the stream comes in in order, can I guarantee the values will be added to my array in the same order? Also, I’m partitioning by key

So if I’m looking at my_property with a window count of 2 and slide 1 for key_1, and my_property == foo at t0 but my_property == bar at t1, can i guarantee my array will be ordered like [foo, bar] …I realize this assumes my stream is coming in in order, but let’s just say it does.

Yes the order is guaranteed to be respected based on whatever partition key you are using, given that the input is keyed correctly.

1 Like