libenchao commented on a change in pull request #11482: [FLINK-16581][table] Minibatch deduplication lack state TTL bug fix URL: https://github.com/apache/flink/pull/11482#discussion_r407162656
########## File path: flink-table/flink-table-runtime-blink/src/test/java/org/apache/flink/table/runtime/operators/deduplicate/MiniBatchDeduplicateKeepLastRowFunctionTest.java ########## @@ -113,4 +113,42 @@ public void testWithGenerateRetraction() throws Exception { testHarness.close(); assertor.assertOutputEqualsSorted("output wrong.", expectedOutput, testHarness.getOutput()); } + + @Test + public void tesKeepLastRowWithStateTtlAndGenerateRetraction() throws Exception { + MiniBatchDeduplicateKeepLastRowFunction func = createFunction(true, minTime.toMilliseconds()); + OneInputStreamOperatorTestHarness<BaseRow, BaseRow> testHarness = createTestHarness(func); + testHarness.setup(); + testHarness.open(); + + testHarness.processElement(record("book", 1L, 10)); + testHarness.processElement(record("book", 2L, 11)); + // output is empty because bundle not trigger yet. + Assert.assertTrue(testHarness.getOutput().isEmpty()); + testHarness.processElement(record("book", 1L, 13)); + + testHarness.setStateTtlProcessingTime(30); + //Incremental cleanup is an eventual clean up, more state access guarantee more expired state cleaned + for (long i = 3; i < 30; i++){ Review comment: nit: `) {` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services