aiborodin commented on code in PR #14312:
URL: https://github.com/apache/iceberg/pull/14312#discussion_r2605872093


##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicCommitter.java:
##########
@@ -200,27 +198,27 @@ private void commitPendingRequests(
       throws IOException {
     long checkpointId = commitRequestMap.lastKey();
     List<ManifestFile> manifests = Lists.newArrayList();
-    NavigableMap<Long, List<WriteResult>> pendingResults = Maps.newTreeMap();
+    NavigableMap<Long, WriteResult> pendingResults = Maps.newTreeMap();
     for (Map.Entry<Long, List<CommitRequest<DynamicCommittable>>> e : 
commitRequestMap.entrySet()) {
+      WriteResult.Builder builder = WriteResult.builder();
       for (CommitRequest<DynamicCommittable> committable : e.getValue()) {
-        if (Arrays.equals(EMPTY_MANIFEST_DATA, 
committable.getCommittable().manifest())) {
-          pendingResults
-              .computeIfAbsent(e.getKey(), unused -> Lists.newArrayList())
-              .add(EMPTY_WRITE_RESULT);
-        } else {
-          DeltaManifests deltaManifests =
-              SimpleVersionedSerialization.readVersionAndDeSerialize(
-                  DeltaManifestsSerializer.INSTANCE, 
committable.getCommittable().manifest());
-          pendingResults
-              .computeIfAbsent(e.getKey(), unused -> Lists.newArrayList())
-              .add(FlinkManifestUtil.readCompletedFiles(deltaManifests, 
table.io(), table.specs()));
-          manifests.addAll(deltaManifests.manifests());
+        if (!Arrays.deepEquals(EMPTY_MANIFEST_DATA, 
committable.getCommittable().manifests())) {
+          for (byte[] manifest : committable.getCommittable().manifests()) {
+            DeltaManifests deltaManifests =
+                SimpleVersionedSerialization.readVersionAndDeSerialize(
+                    DeltaManifestsSerializer.INSTANCE, manifest);
+            builder.add(
+                FlinkManifestUtil.readCompletedFiles(deltaManifests, 
table.io(), table.specs()));
+            manifests.addAll(deltaManifests.manifests());
+          }
         }
+
+        pendingResults.put(e.getKey(), builder.build());
       }
     }
 
-    CommitSummary summary = new CommitSummary();
-    summary.addAll(pendingResults);
+    // TODO: Fix aggregated commit summary logged multiple times per each each 
checkpoint commit

Review Comment:
   This is a separate issue, unrelated to this change. 
   The committer logs the same `CommitSummary` across multiple commits for 
different checkpoints.



##########
flink/v2.0/flink/src/test/java/org/apache/iceberg/flink/sink/dynamic/TestDynamicIcebergSink.java:
##########
@@ -423,6 +426,26 @@ void testPartitionSpecEvolution() throws Exception {
             new DynamicIcebergDataImpl(SimpleDataUtil.SCHEMA, "t1", "main", 
spec2));
 
     runTest(rows);
+
+    // Validate the table has expected partition specs
+    Table table = 
CATALOG_EXTENSION.catalog().loadTable(TableIdentifier.of(DATABASE, "t1"));
+
+    Map<Integer, PartitionSpec> tableSpecs = table.specs();
+    List<PartitionSpec> expectedSpecs = List.of(spec1, spec2, 
PartitionSpec.unpartitioned());
+
+    assertThat(tableSpecs).hasSize(expectedSpecs.size());
+    expectedSpecs.forEach(
+        expectedSpec ->
+            assertThat(
+                    tableSpecs.values().stream()
+                        // TODO: Fix PartitionSpecEvolution#evolve to re-use 
PartitionField names of

Review Comment:
   I expect it to be a relatively simple change. However, it seems worth a 
separate PR because it doesn't directly relate to the scope of this change.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to