c-thiel commented on code in PR #804: URL: https://github.com/apache/iceberg-rust/pull/804#discussion_r1886757422
########## crates/iceberg/src/spec/table_metadata_builder.rs: ########## @@ -740,6 +740,32 @@ impl TableMetadataBuilder { .set_default_partition_spec(Self::LAST_ADDED) } + /// Remove partition specs by their ids from the table metadata. + /// Does nothing if a spec id is not present. + /// + /// If the default partition spec is removed, it is re-added + /// upon build. + pub fn remove_partition_specs(mut self, spec_ids: &[i32]) -> Self { + let mut removed_specs = Vec::with_capacity(spec_ids.len()); + + self.metadata.partition_specs.retain(|k, _| { + if spec_ids.contains(k) { Review Comment: I switched the order - makes more sense to me this way. We are now looping over a probably very short array doing O(1) lookups. `partition_specs` is a HashMap -- 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