manuzhang commented on code in PR #2417:
URL: https://github.com/apache/iceberg-rust/pull/2417#discussion_r3328908378
##########
crates/iceberg/src/spec/schema/mod.rs:
##########
@@ -421,6 +421,52 @@ impl Schema {
pub fn field_id_to_fields(&self) -> &HashMap<i32, NestedFieldRef> {
&self.id_to_field
}
+
+ /// Returns the minimum table format version required by any type in this
schema.
+ ///
+ /// Returns [`None`] when the schema contains no type with a specific
minimum
+ /// table format version requirement.
+ pub fn min_format_version(&self) -> Option<FormatVersion> {
+ self.id_to_field
+ .values()
+ .filter_map(|field| field.field_type.as_primitive_type())
+ .filter_map(PrimitiveType::min_format_version)
+ .max()
+ }
+
+ /// Validates that all schema types are supported by the table format
version.
+ pub fn validate_compatible_with_format_version(
Review Comment:
I don't see the point of adding such a test. Even if it costs time for deep
nested structs, DDL is not a frequent action in practice, isn't it? Anyway, I
don't think this should be part of unit tests.
--
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]