xuzhiwen1255 commented on code in PR #5642: URL: https://github.com/apache/iceberg/pull/5642#discussion_r961221742
########## flink/v1.15/flink/src/test/java/org/apache/iceberg/flink/sink/TestIcebergStreamWriter.java: ########## @@ -233,7 +233,31 @@ public void testBoundedStreamCloseWithEmittingDataFiles() throws Exception { Assert.assertEquals(expectedDataFiles * 2, result.dataFiles().length); } } + @Test + public void testBoundedStreamTriggeredEndInputBeforeTriggeringCheckpoint() throws Exception { Review Comment: > thx for adding the unit test. I am a little concerned with one of the existing unit test. why do we want to make sure if `endInput` is called twice, the writer is emitting the result twice. This behavior is a little odd to me. maybe we should dig out the history behind this test. > > ``` > @Test > public void testBoundedStreamCloseWithEmittingDataFiles() throws Exception { > try (OneInputStreamOperatorTestHarness<RowData, WriteResult> testHarness = > createIcebergStreamWriter()) { > testHarness.processElement(SimpleDataUtil.createRowData(1, "hello"), 1); > testHarness.processElement(SimpleDataUtil.createRowData(2, "world"), 2); > > Assertions.assertThat(testHarness.getOneInputOperator()).isInstanceOf(BoundedOneInput.class); > ((BoundedOneInput) testHarness.getOneInputOperator()).endInput(); > > long expectedDataFiles = partitioned ? 2 : 1; > WriteResult result = WriteResult.builder().addAll(testHarness.extractOutputValues()).build(); > Assert.assertEquals(0, result.deleteFiles().length); > Assert.assertEquals(expectedDataFiles, result.dataFiles().length); > > // invoke endInput again. > ((BoundedOneInput) testHarness.getOneInputOperator()).endInput(); > > result = WriteResult.builder().addAll(testHarness.extractOutputValues()).build(); > Assert.assertEquals(0, result.deleteFiles().length); > Assert.assertEquals(expectedDataFiles * 2, result.dataFiles().length); > } > } > ``` Yes, the test failed, should we delete it, or should we modify it -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org