c-thiel commented on code in PR #2188:
URL: https://github.com/apache/iceberg-rust/pull/2188#discussion_r3363120101


##########
crates/iceberg/src/spec/schema/mod.rs:
##########
@@ -421,6 +425,85 @@ impl Schema {
     pub fn field_id_to_fields(&self) -> &HashMap<i32, NestedFieldRef> {
         &self.id_to_field
     }
+
+    /// Minimum [`FormatVersion`] required to represent all *types* in this 
schema.
+    ///
+    /// Types only; for initial-default version floors see 
[`Schema::check_format_compatibility`].
+    pub fn min_format_version(&self) -> FormatVersion {
+        // `id_to_field` is flattened, so the max over all fields covers 
nested ones too.
+        self.id_to_field
+            .values()
+            .map(|f| leaf_min_format_version(&f.field_type))
+            .max()
+            .unwrap_or(FormatVersion::V1)
+    }
+
+    /// Returns an error listing every field incompatible with 
`format_version`.
+    /// Mirrors Java's `Schema.checkCompatibility()`. Two checks per field:
+    ///
+    /// - **Type** — per `leaf_min_format_version`.

Review Comment:
   
https://github.com/apache/iceberg-rust/pull/2188/commits/15884b99c2faffd770c00865280bbe574b0c526e



-- 
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]

Reply via email to