You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/02/17 06:04:35 UTC

[GitHub] [iceberg] zhongyujiang commented on a change in pull request #4117: Flink: fix flink unit test testHashDistributeMode

zhongyujiang commented on a change in pull request #4117:
URL: https://github.com/apache/iceberg/pull/4117#discussion_r808701280



##########
File path: flink/v1.14/flink/src/test/java/org/apache/iceberg/flink/TestFlinkTableSink.java
##########
@@ -277,15 +277,15 @@ public void testHashDistributeMode() throws Exception {
       ));
 
       // Sometimes we will have more than one checkpoint if we pass the auto checkpoint interval,
-      // thus producing multiple snapshots.  Here we assert that each snapshot has only 1 file per partition.
+      // thus producing multiple snapshots.  Here we assert that each snapshot has no more than 1 file per partition.
       Map<Long, List<DataFile>> snapshotToDataFiles = SimpleDataUtil.snapshotToDataFiles(table);
       for (List<DataFile> dataFiles : snapshotToDataFiles.values()) {
-        Assert.assertEquals("There should be 1 data file in partition 'aaa'", 1,
-            SimpleDataUtil.matchingPartitions(dataFiles, table.spec(), ImmutableMap.of("data", "aaa")).size());
-        Assert.assertEquals("There should be 1 data file in partition 'bbb'", 1,
-            SimpleDataUtil.matchingPartitions(dataFiles, table.spec(), ImmutableMap.of("data", "bbb")).size());
-        Assert.assertEquals("There should be 1 data file in partition 'ccc'", 1,
-            SimpleDataUtil.matchingPartitions(dataFiles, table.spec(), ImmutableMap.of("data", "ccc")).size());
+        Assert.assertTrue("There should be no more than 1 data file in partition 'aaa'",
+            SimpleDataUtil.matchingPartitions(dataFiles, table.spec(), ImmutableMap.of("data", "aaa")).size() < 2);

Review comment:
       I changed the assert condition, because if there are multiple checkpoints, data may arrive in this way:
   ck1: (1, "aaa")
   ck2: (1, "bbb")
   ...
   so I think we should assert each snapshot has no more than 1 file per partition, since it could be 0 file as well.




-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org