xanderbailey commented on code in PR #3412:
URL: https://github.com/apache/iceberg-rust/pull/3412#discussion_r4252456702


##########
crates/iceberg/src/spec/table_metadata_builder.rs:
##########
@@ -695,27 +695,27 @@ impl TableMetadataBuilder {
             .set_current_schema(Self::LAST_ADDED)
     }
 
-    /// Validate schema field names against partition field names across all 
historical schemas.
+    /// Validate schema field names against the current partition spec's field 
names.
     ///
-    /// Due to Iceberg's multi-version property, this check ignores existing 
schema fields
-    /// that match partition names (schema evolution allows re-adding 
previously removed fields).
-    /// Only NEW field names that conflict with partition names are rejected.
+    /// A name that any schema already has is allowed, since Iceberg keeps 
every schema and
+    /// evolution may re-add a dropped column. Superseded specs are not 
consulted: they are kept
+    /// only to interpret old metadata, so the names they use stay available.
     ///
     /// # Errors
-    /// - Schema field name conflicts with partition field name but doesn't 
exist in any historical schema.
+    /// - A field name new to the table conflicts with a current partition 
field name.
     fn validate_schema_field_names(&self, schema: &Schema) -> Result<()> {
         if self.metadata.schemas.is_empty() {
             return Ok(());
         }
 
         for field_name in schema.field_id_to_name_map().values() {
-            let has_partition_conflict = 
self.metadata.partition_name_exists(field_name);
+            let has_partition_conflict = 
self.metadata.default_partition_name_exists(field_name);

Review Comment:
   You're actually very right, I missed `Builder.add(sourceId, fieldId, name, 
transform)`... let me come back to this



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