twuebi commented on code in PR #580:
URL: https://github.com/apache/iceberg-go/pull/580#discussion_r2393877967


##########
table/metadata.go:
##########
@@ -183,28 +184,37 @@ type MetadataBuilder struct {
        lastAddedSortOrderID *int
 }
 
-func NewMetadataBuilder() (*MetadataBuilder, error) {
+func NewMetadataBuilder(formatVersion int) (*MetadataBuilder, error) {
        return &MetadataBuilder{
-               updates:       make([]Update, 0),
-               schemaList:    make([]*iceberg.Schema, 0),
-               specs:         make([]iceberg.PartitionSpec, 0),
-               props:         make(iceberg.Properties),
-               snapshotList:  make([]Snapshot, 0),
-               snapshotLog:   make([]SnapshotLogEntry, 0),
-               metadataLog:   make([]MetadataLogEntry, 0),
-               sortOrderList: make([]SortOrder, 0),
-               refs:          make(map[string]SnapshotRef),
+               updates:            make([]Update, 0),
+               schemaList:         make([]*iceberg.Schema, 0),
+               specs:              make([]iceberg.PartitionSpec, 0),
+               props:              make(iceberg.Properties),
+               snapshotList:       make([]Snapshot, 0),
+               snapshotLog:        make([]SnapshotLogEntry, 0),
+               metadataLog:        make([]MetadataLogEntry, 0),
+               sortOrderList:      make([]SortOrder, 0),
+               refs:               make(map[string]SnapshotRef),
+               currentSchemaID:    -1,
+               defaultSortOrderID: -1,
+               defaultSpecID:      -1,
+               lastColumnId:       -1,
+               formatVersion:      formatVersion,
        }, nil
 }
 
-func MetadataBuilderFromBase(metadata Metadata) (*MetadataBuilder, error) {
+// MetadataBuilderFromBase creates a MetadataBuilder from an existing Metadata 
object.
+// currentFileLocation is the location where the current version of the 
metadata
+// file is stored. This is used to update the metadata log. If 
currentFileLocation is
+// empty, the metadata log will not be updated. This should only be used to 
stage-create tables.
+func MetadataBuilderFromBase(metadata Metadata, currentFileLocation string) 
(*MetadataBuilder, error) {

Review Comment:
   This is to differentiate between staged to live and live to live, not sure 
how we can make this an internal field without passing the information into 
here, as a rest catalog, we need a handle like that. This also mirrors what 
iceberg-rust is doing 



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