rahulsmahadev commented on code in PR #19114:
URL: https://github.com/apache/iceberg/pull/19114#discussion_r4733868145


##########
spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/actions/RepairTableSparkAction.java:
##########
@@ -314,18 +332,26 @@ private Dataset<Row> 
buildManifestEntryDF(List<ManifestFile> manifests) {
         manifestDF, 
manifestDF.col("manifest").equalTo(entryDF.col("manifest")), "left_semi");
   }
 
-  private List<ManifestFile> writeManifests(
+  private WriteManifests.WrittenManifests writeManifests(
       RepairContext context, int specId, Dataset<Row> entryDF, 
List<ManifestFile> manifests) {
     ManifestWriterFactory writers = manifestWriters(context.tableBroadcast(), 
specId);
     WriteManifests<?> writeFunc =
         context.content() == ManifestContent.DATA
             ? new WriteDataManifests(writers, manifests, context)
             : new WriteDeleteManifests(writers, manifests, context);
 
+    List<ManifestFile> written = Lists.newArrayList();
+    Map<String, Long> totalDeltas = Maps.newHashMap();
     // keeps the table's layout
-    return writeFunc
-        .apply(entryDF.repartition(manifests.size(), entryDF.col("manifest")))
-        .collectAsList();
+    for (WriteManifests.WrittenManifests task :
+        writeFunc
+            .apply(entryDF.repartition(manifests.size(), 
entryDF.col("manifest")))
+            .collectAsList()) {
+      written.addAll(task.manifests());
+      task.totalDeltas().forEach((total, delta) -> totalDeltas.merge(total, 
delta, Long::sum));

Review Comment:
   Good point. I added `repairSumsTotalsAcrossManifests`: six corrupt manifests 
in one group, each with two repaired entries. It checks that the totals match 
the sums of the original files. The two entries per manifest are summed within 
a write task, and the manifests are spread over the write tasks by hash, so 
they are also summed across tasks. I checked that it fails if either sum 
overwrites instead of adding.
   



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