tanmayrauth commented on code in PR #902:
URL: https://github.com/apache/iceberg-go/pull/902#discussion_r3090746088
##########
table/metadata.go:
##########
@@ -1164,6 +1171,56 @@ func (b *MetadataBuilder) RemoveSchemas(ints []int)
error {
return nil
}
+// SetStatistics adds or replaces a statistics file for the given snapshot. If
a statistics
+// file with the same snapshot ID already exists it is replaced, otherwise the
file is appended.
+func (b *MetadataBuilder) SetStatistics(stats StatisticsFile) error {
+ replaced := false
+ for i, s := range b.statisticsList {
+ if s.SnapshotID == stats.SnapshotID {
+ b.statisticsList[i] = stats
+ replaced = true
+
+ break
+ }
+ }
+
+ if !replaced {
+ b.statisticsList = append(b.statisticsList, stats)
+ }
+
+ b.updates = append(b.updates, NewSetStatisticsUpdate(stats))
+
+ return nil
+}
+
+// RemoveStatistics removes the statistics file associated with the given
snapshot ID.
+// It is not an error if no such file exists.
+func (b *MetadataBuilder) RemoveStatistics(snapshotID int64) error {
+ b.statisticsList = slices.DeleteFunc(b.statisticsList, func(s
StatisticsFile) bool {
+ return s.SnapshotID == snapshotID
+ })
+ b.updates = append(b.updates, NewRemoveStatisticsUpdate(snapshotID))
+
+ return nil
+}
+
+// AddEncryptionKey adds or replaces an encryption key indexed by its key-id.
+func (b *MetadataBuilder) AddEncryptionKey(key EncryptionKey) error {
Review Comment:
Fixed. AddEncryptionKey now rejects calls when formatVersion < 3 with a
descriptive error, consistent with the existing minFormatVersionRowLineage
pattern.
--
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]