dawidwys commented on code in PR #25921:
URL: https://github.com/apache/flink/pull/25921#discussion_r1907090365


##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/SourceWatermarkITCase.scala:
##########
@@ -305,4 +306,56 @@ class SourceWatermarkITCase extends StreamingTestBase {
     assertThat(actualWatermark).isEqualTo(expectedWatermarkOutput)
     assertThat(sink.getAppendResults.sorted).isEqualTo(expectedData.sorted)
   }
+
+  @Test
+  def testWatermarkNotMovingBack(): Unit = {
+    val data = Seq(
+      row(1, LocalDateTime.parse("2024-01-01T00:00:00")),
+      row(3, LocalDateTime.parse("2024-01-03T00:00:00")),
+      row(2, LocalDateTime.parse("2024-01-02T00:00:00"))
+    )
+
+    val dataId = TestValuesTableFactory.registerData(data)
+
+    val ddl =
+      s"""
+         | CREATE Table VirtualTable (
+         |   a INT,
+         |   c TIMESTAMP(3),
+         |   WATERMARK FOR c as c
+         | ) with (
+         |   'connector' = 'values',
+         |   'bounded' = 'false',
+         |   'scan.watermark.emit.strategy' = 'on-periodic',
+         |   'enable-watermark-push-down' = 'true',
+         |   'disable-lookup' = 'true',
+         |   'data-id' = '$dataId'
+         | )
+         |""".stripMargin
+
+    tEnv.executeSql(ddl)
+    tEnv.getConfig.set(CoreOptions.DEFAULT_PARALLELISM.key(), "1")
+
+    val expectedWatermarkOutput = Seq("2024-01-01T00:00", "2024-01-03T00:00", 
"2024-01-03T00:00")

Review Comment:
   Added a comment explaining the behaviour as well as why the test is 
deterministic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to