rdblue commented on code in PR #4525:
URL: https://github.com/apache/iceberg/pull/4525#discussion_r846841694


##########
api/src/main/java/org/apache/iceberg/types/Types.java:
##########
@@ -524,6 +563,91 @@ public boolean equals(Object o) {
     public int hashCode() {
       return Objects.hash(NestedField.class, id, isOptional, name, type);
     }
+
+    private static JsonNode validateDefault(String name, Type type, JsonNode 
defaultValue) {
+      if (defaultValue != null && !isValidDefault(type, defaultValue)) {
+        throw new ValidationException("Invalid default value for field %s: %s 
not a %s", name, defaultValue, type);
+      }
+      return defaultValue;
+    }
+
+    @SuppressWarnings("checkstyle:CyclomaticComplexity")
+    private static boolean isValidDefault(Type type, JsonNode defaultValue) {

Review Comment:
   Iceberg uses visitors to separate the logic for schema traversal from the 
logic for individual decisions. Can you please use a visitor?



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