fvaleye commented on code in PR #1619: URL: https://github.com/apache/iceberg-rust/pull/1619#discussion_r2288094042
########## crates/iceberg/src/spec/table_metadata_builder.rs: ########## @@ -679,7 +682,54 @@ impl TableMetadataBuilder { /// Add a schema and set it as the current schema. pub fn add_current_schema(self, schema: Schema) -> Result<Self> { - self.add_schema(schema).set_current_schema(Self::LAST_ADDED) + self.add_schema(schema)? + .set_current_schema(Self::LAST_ADDED) + } + + /// Check if schema field names conflict with existing partition field names. + /// + /// This validation prevents introducing new field names that match existing partition field names + /// that don't correspond to any field in the current schema. Field names that already exist in the + /// current schema are allowed since partition fields are typically derived from schema fields. + /// + /// # Errors + /// - Schema field name conflicts with existing partition field name that doesn't correspond to any current schema field. + fn check_schema_partition_name_conflicts(&self, schema: &Schema) -> Result<()> { + let existing_partition_field_names: HashSet<&str> = self + .metadata + .partition_specs + .values() + .flat_map(|spec| spec.fields().iter().map(|field| field.name.as_str())) + .collect(); + + let current_schema_field_names: HashSet<&str> = self Review Comment: I fixed it! -- 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