Xuanwo commented on code in PR #804: URL: https://github.com/apache/iceberg-rust/pull/804#discussion_r1886542369
########## 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: > Why not turn the `spec_ids` into a `HashSet`? :) I have thought about this, but it would introduce an additional allocation, which I believe isn't worth 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