kevinjqliu commented on code in PR #327:
URL: https://github.com/apache/iceberg-go/pull/327#discussion_r1989735973


##########
manifest.go:
##########
@@ -1477,131 +1470,68 @@ func (d *dataFile) EqualityFieldIDs() []int {
 
 func (d *dataFile) SortOrderID() *int { return d.SortOrder }
 
-// ManifestEntryV1Builder is a helper for building a V1 manifest entry
-// struct which will conform to the ManifestEntry interface.
-type ManifestEntryV1Builder struct {
-       m *manifestEntryV1
+type ManifestEntryBuilder struct {
+       m *manifestEntry
 }
 
-// NewManifestEntryV1Builder is passed all of the required fields and then 
allows
-// all of the optional fields to be set by calling the corresponding methods
-// before calling [ManifestEntryV1Builder.Build] to construct the object.
-func NewManifestEntryV1Builder(status ManifestEntryStatus, snapshotID int64, 
data DataFile) (*ManifestEntryV1Builder, error) {
-       return &ManifestEntryV1Builder{
-               m: &manifestEntryV1{
+func NewManifestEntryBuilder(status ManifestEntryStatus, snapshotID *int64, 
data DataFile) *ManifestEntryBuilder {
+       return &ManifestEntryBuilder{
+               m: &manifestEntry{
                        EntryStatus: status,
                        Snapshot:    snapshotID,
                        Data:        data,
                },
-       }, nil
-}
-
-func (b *ManifestEntryV1Builder) Build() ManifestEntry {
-       return b.m
-}
-
-type manifestEntryV1 struct {
-       EntryStatus ManifestEntryStatus `avro:"status"`
-       Snapshot    int64               `avro:"snapshot_id"`
-       SeqNum      *int64
-       FileSeqNum  *int64
-       Data        DataFile `avro:"data_file"`
-}
-
-type fallbackManifestEntryV1 struct {
-       manifestEntryV1
-       Snapshot *int64 `avro:"snapshot_id"`
-}
-
-func (f *fallbackManifestEntryV1) toEntry() *manifestEntryV1 {
-       f.manifestEntryV1.Snapshot = *f.Snapshot
-
-       return &f.manifestEntryV1
-}
-
-func (m *manifestEntryV1) inheritSeqNum(manifest ManifestFile) {}
-
-func (m *manifestEntryV1) Status() ManifestEntryStatus { return m.EntryStatus }
-func (m *manifestEntryV1) SnapshotID() int64           { return m.Snapshot }
-
-func (m *manifestEntryV1) SequenceNum() int64 {
-       if m.SeqNum == nil {
-               return 0
        }
-
-       return *m.SeqNum
 }
 
-func (m *manifestEntryV1) FileSequenceNum() *int64 {
-       return m.FileSeqNum
-}
-
-func (m *manifestEntryV1) DataFile() DataFile { return m.Data }
-
-func (m *manifestEntryV1) wrap(status ManifestEntryStatus, snapshotID int64, 
seqNum int64, fileSeqNum *int64, datafile DataFile) ManifestEntry {
-       m.EntryStatus = status
-       m.Snapshot = snapshotID
-       if seqNum > 0 {
-               m.SeqNum = &seqNum
-       }
-
-       m.FileSeqNum = fileSeqNum
-
-       m.Data = datafile
-
-       return m
-}
-
-// ManifestEntryV2Builder is a helper for building a V2 manifest entry
-// struct which will conform to the ManifestEntry interface.
-type ManifestEntryV2Builder struct {
-       m *manifestEntryV2
-}
-
-// NewManifestEntryV2Builder is passed all of the required fields and then 
allows
-// all of the optional fields to be set by calling the corresponding methods
-// before calling [ManifestEntryV2Builder.Build] to construct the object.
-func NewManifestEntryV2Builder(status ManifestEntryStatus, snapshotID int64, 
data DataFile) *ManifestEntryV2Builder {
-       return &ManifestEntryV2Builder{
-               m: &manifestEntryV2{
-                       EntryStatus: status,
-                       Snapshot:    &snapshotID,
-                       Data:        data,
-               },
-       }
-}
-
-// SequenceNum sets the sequence number for the manifest entry.
-func (b *ManifestEntryV2Builder) SequenceNum(num int64) 
*ManifestEntryV2Builder {
+func (b *ManifestEntryBuilder) SequenceNum(num int64) *ManifestEntryBuilder {
        b.m.SeqNum = &num
 
        return b
 }
 
-// FileSequenceNum sets the file sequence number for the manifest entry.
-func (b *ManifestEntryV2Builder) FileSequenceNum(num int64) 
*ManifestEntryV2Builder {
+func (b *ManifestEntryBuilder) FileSequenceNum(num int64) 
*ManifestEntryBuilder {
        b.m.FileSeqNum = &num
 
        return b
 }
 
-// Build returns the constructed manifest entry, after calling Build this
-// builder should not be used further as we avoid copying by just returning
-// a pointer to the constructed manifest entry. Further calls to the modifier
-// methods after calling build would modify the constructed ManifestEntry.
-func (b *ManifestEntryV2Builder) Build() ManifestEntry {
+func (b *ManifestEntryBuilder) Build() ManifestEntry {
        return b.m
 }
 
-type manifestEntryV2 struct {
+type manifestEntry struct {
        EntryStatus ManifestEntryStatus `avro:"status"`
        Snapshot    *int64              `avro:"snapshot_id"`
        SeqNum      *int64              `avro:"sequence_number"`
        FileSeqNum  *int64              `avro:"file_sequence_number"`
        Data        DataFile            `avro:"data_file"`
 }
 
-func (m *manifestEntryV2) inheritSeqNum(manifest ManifestFile) {
+func (m *manifestEntry) Status() ManifestEntryStatus { return m.EntryStatus }
+func (m *manifestEntry) SnapshotID() int64 {
+       if m.Snapshot == nil {
+               return -1

Review Comment:
   ah thanks! make sense



-- 
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-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to