szehon-ho commented on code in PR #7389:
URL: https://github.com/apache/iceberg/pull/7389#discussion_r1184210318


##########
api/src/main/java/org/apache/iceberg/actions/RewritePositionDeleteFiles.java:
##########
@@ -41,11 +94,83 @@
   RewritePositionDeleteFiles filter(Expression expression);
 
   /** The action result that contains a summary of the execution. */
+  @Value.Immutable
   interface Result {
-    /** Returns the count of the position deletes that been rewritten. */
+    List<PositionDeleteGroupRewriteResult> rewriteResults();
+
+    /** Returns the count of the position delete files that been rewritten. */
+    default int rewrittenDeleteFilesCount() {
+      return rewriteResults().stream()
+          
.mapToInt(PositionDeleteGroupRewriteResult::rewrittenDeleteFilesCount)
+          .sum();
+    }
+
+    /** Returns the count of the added position delete files. */
+    default int addedDeleteFilesCount() {
+      return rewriteResults().stream()
+          .mapToInt(PositionDeleteGroupRewriteResult::addedDeleteFilesCount)
+          .sum();
+    }
+
+    /** Returns the number of bytes of position delete files that have been 
rewritten */
+    default long rewrittenBytesCount() {
+      return rewriteResults().stream()
+          .mapToLong(PositionDeleteGroupRewriteResult::rewrittenBytesCount)
+          .sum();
+    }
+
+    /** Returns the number of bytes of newly added position delete files */
+    default long addedBytesCount() {
+      return rewriteResults().stream()
+          .mapToLong(PositionDeleteGroupRewriteResult::addedBytesCount)
+          .sum();
+    }
+  }
+
+  /**
+   * For a particular position delete file group, the number of position 
delete files which are
+   * newly created and the number of files which were formerly part of the 
table but have been
+   * rewritten.
+   */
+  @Value.Immutable
+  interface PositionDeleteGroupRewriteResult {
+    /** Description of this position delete file group * */
+    PositionDeleteGroupInfo info();
+
+    /** Returns the count of the position delete files that been rewritten in 
this group. */
     int rewrittenDeleteFilesCount();
 
-    /** Returns the count of the added delete files. */
+    /** Returns the count of the added position delete files in this group. */
     int addedDeleteFilesCount();
+
+    /**
+     * Returns the number of bytes of position delete files that have been 
rewritten in this group
+     */
+    long rewrittenBytesCount();
+
+    /** Returns the number of bytes of newly added position delete files in 
this group */
+    long addedBytesCount();
+  }
+
+  /**
+   * A description of a position delete file group, when it was processed, and 
within which
+   * partition. For use tracking rewrite operations and for returning results.
+   */
+  @Value.Immutable
+  interface PositionDeleteGroupInfo {
+    /**
+     * returns which position delete file group this is out of the total set 
of file groups for this
+     * rewrite
+     */
+    int globalIndex();
+
+    /**
+     * returns which position delete file group this is out of the set of file 
groups for this
+     * partition
+     */
+    int partitionIndex();
+
+    /** returns which partition this position delete file group contains files 
from */
+    StructLike partition();

Review Comment:
   Added clarifying comment (its the coerced one)



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