Nic Townsend
11/25/2024, 10:39 AMSQL Union - what is the expectation of https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/set-ops/ UNION/UNION ALL regarding watermarks?
https://nightlies.apache.org/flink/flink-docs-master/docs/concepts/time/#watermarks-in-parallel-streams says:
> As the watermarks flow through the streaming program, they advance the event time at the operators where they arrive. Whenever an operator advances its event time, it generates a new watermark downstream for its successor operators.
>
> Some operators consume multiple input streams; a union, for example, or operators following a keyBy(…) or partition(…) function. Such an operator’s current event time is the minimum of its input streams’ event times. As its input streams update their event times, so does the operator.
But using current_watermark after a union does not give the expected results. In UNION ALL - every row gets its own watermark. In UNION the first source has null and then the second source (with later timestamps) is being watermarked with the later timestamp.
Which disagrees with https://stackoverflow.com/questions/60383993/how-does-flink-handle-watermarks-with-union-operators#:~:text=The%20watermark%20with%20Union%20works,min%20of%20all%20input%20streams.