zeroshade commented on code in PR #2352:
URL: https://github.com/apache/iceberg-go/pull/2352#discussion_r4415141318


##########
table/snapshots.go:
##########
@@ -106,15 +110,29 @@ type updateMetrics struct {
        removedEqDeletes      int64
 }
 
+// contentSizeInBytes returns the bytes a file contributes to the table. A DV
+// shares its Puffin file with other DVs, so it counts only its own blob.
+func contentSizeInBytes(df iceberg.DataFile) int64 {
+       if IsDeletionVector(df) && df.ContentSizeInBytes() != nil {
+               return *df.ContentSizeInBytes()
+       }
+
+       return df.FileSizeBytes()
+}
+
 func (m *updateMetrics) addDataFile(df iceberg.DataFile) error {
-       m.addedFileSize += df.FileSizeBytes()
+       m.addedFileSize += contentSizeInBytes(df)
        switch df.ContentType() {
        case iceberg.EntryContentData:
                m.addedDataFiles++
                m.addedRecords += df.Count()
        case iceberg.EntryContentPosDeletes:
                m.addedDeleteFiles++

Review Comment:
   Non-blocking: `added-position-delete-files` and 
`removed-position-delete-files` no longer include DVs, and the size totals for 
v3 tables go down. Could you add a line under "Unreleased compatibility notes" 
in `website/src/releases.md` so people with dashboards on these keys know why 
the values changed?



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