dttung2905 commented on code in PR #560:
URL: https://github.com/apache/iceberg-go/pull/560#discussion_r2356383293
##########
manifest.go:
##########
@@ -1327,6 +1344,40 @@ func (m *ManifestListWriter) AddManifests(files
[]ManifestFile) error {
return err
}
}
+ case 3:
+ for _, file := range files {
+ if file.Version() != 3 {
+ return fmt.Errorf("%w: ManifestListWriter only
supports version 3 manifest files", ErrInvalidArgument)
+ }
+ wrapped := *(file.(*manifestFile))
+
+ // Ref:
https://github.com/apache/iceberg/blob/ea2071568dc66148b483a82eefedcd2992b435f7/core/src/main/java/org/apache/iceberg/ManifestListWriter.java#L157-L168
+ if wrapped.Content == ManifestContentData &&
wrapped.FirstRowId == nil {
+ if m.nextRowID != nil {
+ wrapped.FirstRowId = m.nextRowID
+ *m.nextRowID +=
wrapped.ExistingRowsCount + wrapped.AddedRowsCount
+ }
+ }
+
+ // Ref:
https://github.com/apache/iceberg/blob/ea2071568dc66148b483a82eefedcd2992b435f7/core/src/main/java/org/apache/iceberg/V3Metadata.java#L98-L122
+ if wrapped.SeqNumber == -1 {
+ if m.commitSnapshotID !=
wrapped.AddedSnapshotID {
+ return fmt.Errorf("found unassigned
sequence number for a manifest from snapshot %d != %d",
+ m.commitSnapshotID,
wrapped.AddedSnapshotID)
+ }
+ wrapped.SeqNumber = m.sequenceNumber
+ }
+
+ if wrapped.MinSeqNumber == -1 {
+ if m.commitSnapshotID !=
wrapped.AddedSnapshotID {
+ return fmt.Errorf("found unassigned
sequence number for a manifest from snapshot: %d", wrapped.AddedSnapshotID)
+ }
+ wrapped.MinSeqNumber = m.sequenceNumber
+ }
+ if err := m.writer.Encode(wrapped); err != nil {
+ return err
+ }
Review Comment:
Initially, I want it to be separated from version 2 to avoid changing the
existing logic as much as possible. But yes you are right, the only different
is from the first row id for lineage tracking. I have combined both logic
--
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]