You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/05/16 19:05:04 UTC

[GitHub] [iceberg] wmoustafa commented on a diff in pull request #4732: API: Add default value API

wmoustafa commented on code in PR #4732:
URL: https://github.com/apache/iceberg/pull/4732#discussion_r869696925


##########
api/src/main/java/org/apache/iceberg/types/Types.java:
##########
@@ -415,43 +415,64 @@ public int hashCode() {
 
   public static class NestedField implements Serializable {
     public static NestedField optional(int id, String name, Type type) {
-      return new NestedField(true, id, name, type, null);
+      return new NestedField(true, id, name, type, null, null, null);
     }
 
     public static NestedField optional(int id, String name, Type type, String doc) {
-      return new NestedField(true, id, name, type, doc);
+      return new NestedField(true, id, name, type, doc, null, null);
+    }
+
+    public static NestedField optional(int id, String name, Type type, String doc,
+                                       Object initialDefault, Object writeDefault) {
+      return new NestedField(true, id, name, type, doc, initialDefault, writeDefault);
     }
 
     public static NestedField required(int id, String name, Type type) {
-      return new NestedField(false, id, name, type, null);
+      return new NestedField(false, id, name, type, null, null, null);
     }
 
     public static NestedField required(int id, String name, Type type, String doc) {
-      return new NestedField(false, id, name, type, doc);
+      return new NestedField(false, id, name, type, doc, null, null);
+    }
+
+    public static NestedField required(int id, String name, Type type, String doc,
+                                       Object initialDefault, Object writeDefault) {

Review Comment:
   Is it acceptable to always expect `doc` if we need to declare a default value?



##########
api/src/main/java/org/apache/iceberg/types/Types.java:
##########
@@ -462,7 +483,7 @@ public NestedField asOptional() {
       if (isOptional) {
         return this;
       }
-      return new NestedField(true, id, name, type, doc);
+      return new NestedField(true, id, name, type, doc, initialDefault, writeDefault);

Review Comment:
   Should the API always expect `intialDefault` and `writeDefault`? Can there be an option to provide `initialDefault` only, and set `writeDefault` to the same value?



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org