This is an automated email from the ASF dual-hosted git repository.
liurenjie1024 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
The following commit(s) were added to refs/heads/main by this push:
new e41f17e Add accessor for Schema identifier_field_ids (#388)
e41f17e is described below
commit e41f17e5edf8a1549898fe2874d7fb0379b97ca6
Author: Christian <[email protected]>
AuthorDate: Wed Jun 12 08:29:17 2024 +0200
Add accessor for Schema identifier_field_ids (#388)
* Add accessor for Schema identifier_field_ids
* dont expose HashSet
Co-authored-by: Renjie Liu <[email protected]>
* fix
* Fix accessor
---------
Co-authored-by: Renjie Liu <[email protected]>
---
crates/iceberg/src/spec/schema.rs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/crates/iceberg/src/spec/schema.rs
b/crates/iceberg/src/spec/schema.rs
index acdcae6..2f21f20 100644
--- a/crates/iceberg/src/spec/schema.rs
+++ b/crates/iceberg/src/spec/schema.rs
@@ -327,6 +327,12 @@ impl Schema {
&self.r#struct
}
+ /// Returns [`identifier_field_ids`].
+ #[inline]
+ pub fn identifier_field_ids(&self) -> impl Iterator<Item = i32> + '_ {
+ self.identifier_field_ids.iter().copied()
+ }
+
/// Get field id by full name.
pub fn field_id_by_name(&self, name: &str) -> Option<i32> {
self.name_to_id.get(name).copied()