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/01 17:31:35 UTC

[GitHub] [iceberg] rdblue commented on a change in pull request #4020: Spark 3.0: Reports bytesWritten and recordsWritten to metrics

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



##########
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();
+      }

Review comment:
       Why store these as instance fields if this isn't going to expose them anywhere? I think these could be calculated in the report method.




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