laskoviymishka commented on code in PR #2585:
URL: https://github.com/apache/iceberg-go/pull/2585#discussion_r4640123570


##########
view/metadata_builder.go:
##########
@@ -246,6 +252,41 @@ func (b *MetadataBuilder) addSchema(schema 
*iceberg.Schema) (int, error) {
        return newSchemaID, nil
 }
 
+// checkUniqueFieldIDs returns an error if two fields share an ID, walking
+// struct, list and map children. Unlike NewSchema, it also checks 0 and
+// negative IDs.
+func checkUniqueFieldIDs(seen map[int]string, fields []iceberg.NestedField) 
error {

Review Comment:
   On the offer to change the approach: could we export the all-IDs check from 
the root `iceberg` package and have both builders call it? This body is 
identical to `table.checkUniqueFieldIDs` 
(https://github.com/apache/iceberg-go/blob/dbfc940f3e4e9d740cde80482c7f9c8591afb7c6/table/metadata_schema_compatibility.go#L229-L266),
 and `checkAllDuplicateFieldIDs` already does the same walk 
(https://github.com/apache/iceberg-go/blob/dbfc940f3e4e9d740cde80482c7f9c8591afb7c6/schema.go#L171-L220).
 One helper drops both copies, and the view path gets the list and map 
duplicate tests that only the table copy has today.



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