RussellSpitzer commented on code in PR #11434:
URL: https://github.com/apache/iceberg/pull/11434#discussion_r1823174316


##########
api/src/main/java/org/apache/iceberg/Schema.java:
##########
@@ -586,16 +588,37 @@ private List<NestedField> reassignIds(List<NestedField> 
columns, TypeUtil.GetID
    * @param formatVersion table format version
    */
   public static void checkCompatibility(Schema schema, int formatVersion) {
-    // check the type in each field
+    // accumulate errors as a treemap to keep them in a reasonable order
+    TreeMap<Integer, String> problems = Maps.newTreeMap();
+
+    // check each field's type and defaults
     for (NestedField field : schema.lazyIdToField().values()) {
       Integer minFormatVersion = 
MIN_FORMAT_VERSIONS.get(field.type().typeId());
-      Preconditions.checkState(
-          minFormatVersion == null || formatVersion >= minFormatVersion,
-          "Invalid type in v%s schema: %s %s is not supported until v%s",
-          formatVersion,
-          schema.findColumnName(field.fieldId()),
-          field.type(),
-          minFormatVersion);
+      if (minFormatVersion != null && formatVersion < minFormatVersion) {
+        problems.put(
+            field.fieldId(),
+            String.format(
+                "Invalid type for %s: %s is not supported until v%s",

Review Comment:
   Existing checks in TableMetadata look like
   
   ```             
   "Invalid type in v%s schema: struct.ts_nanos timestamptz_ns is not supported 
until v3"
   ```



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

Reply via email to