zeroshade commented on code in PR #1412:
URL: https://github.com/apache/iceberg-go/pull/1412#discussion_r3553758934
##########
cmd/iceberg/clean_orphan_files.go:
##########
@@ -99,9 +99,17 @@ func buildCleanOrphanFilesResult(tbl *table.Table, result
table.OrphanCleanupRes
files = result.DeletedFiles
}
+ orphanSizes := make(map[string]int64, len(result.OrphanFiles))
+ for _, f := range result.OrphanFiles {
+ orphanSizes[f.Path] = f.SizeBytes
+ }
+
entries := make([]OrphanFileEntry, 0, len(files))
for _, f := range files {
- entries = append(entries, OrphanFileEntry{Path: f})
+ entries = append(entries, OrphanFileEntry{
+ Path: f,
+ SizeBytes: orphanSizes[f],
Review Comment:
nit: this size lookup assumes `DeletedFiles` is a subset of `OrphanFiles` (a
path absent from the map silently yields `SizeBytes: 0`). True today since both
derive from the same scan, but it's an undocumented invariant — filtering
`OrphanFiles` by the deleted set would remove the implicit dependency.
##########
table/orphan_cleanup.go:
##########
@@ -161,11 +161,17 @@ func WithEqualAuthorities(authorities map[string]string)
OrphanCleanupOption {
type OrphanCleanupResult struct {
OrphanFileLocations []string
+ OrphanFiles []OrphanFile
Review Comment:
nit: `OrphanFiles` and `OrphanFileLocations` carry duplicate path data. A
short doc comment noting `OrphanFileLocations` is retained for backward
compatibility while `OrphanFiles` is the canonical richer form would help
future readers.
--
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]