liurenjie1024 commented on code in PR #25:
URL: https://github.com/apache/iceberg-rust/pull/25#discussion_r1288059896
##########
crates/iceberg/src/spec/schema.rs:
##########
@@ -84,28 +206,853 @@ impl Schema {
pub fn schema_id(&self) -> i32 {
self.schema_id
}
+
+ /// Returns [`r#struct`].
+ #[inline]
+ pub fn as_struct(&self) -> &StructType {
+ &self.r#struct
+ }
+
+ /// Get field id by full name.
+ pub fn field_id_by_name(&self, name: &str) -> Option<i32> {
+ self.name_to_id.get(name).cloned()
Review Comment:
It's a rust specific problem, `Hashmap::get(key)` returns a reference to
value, e.g. `&i32` here. We use `cloned` to avoid returning a reference to
`i32`, it's not a big problem since it's just a dereference to a pointer.
--
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]