rdblue commented on a change in pull request #4020:
URL: https://github.com/apache/iceberg/pull/4020#discussion_r796835456



##########
File path: 
spark/v3.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkWrite.java
##########
@@ -492,9 +495,26 @@ public void doCommit(long epochId, WriterCommitMessage[] 
messages) {
 
   public static class TaskCommit implements WriterCommitMessage {
     private final DataFile[] taskFiles;
+    private long bytesWritten = 0L;
+    private long recordsWritten = 0L;
 
     TaskCommit(DataFile[] taskFiles) {
       this.taskFiles = taskFiles;
+      for (DataFile dataFile : taskFiles) {
+        this.bytesWritten += dataFile.fileSizeInBytes();
+        this.recordsWritten += dataFile.recordCount();
+      }
+    }
+
+    // Reports bytesWritten and recordsWritten to the Spark output metrics.
+    // Can only be called in executor.
+    void reportsToOutputMetrics() {

Review comment:
       I think `reportOutputMetrics` is a slightly better name.




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