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


##########
api/src/main/java/org/apache/iceberg/UpdateSchema.java:
##########
@@ -125,16 +185,23 @@ default UpdateSchema addColumn(String parent, String 
name, Type type) {
    * @param name name for the new column
    * @param type type for the new column
    * @param doc documentation string for the new column
+   * @param defaultValue a default value for the column in existing rows
    * @return this for method chaining
    * @throws IllegalArgumentException If parent doesn't identify a struct
    */
-  UpdateSchema addColumn(String parent, String name, Type type, String doc);
+  default UpdateSchema addColumn(
+      String parent, String name, Type type, String doc, Object defaultValue) {
+    throw new UnsupportedOperationException("Default values are not 
supported");
+  }
 
   /**
    * Add a new required top-level column.
    *
-   * <p>This is an incompatible change that can break reading older data. This 
method will result in
-   * an exception unless {@link #allowIncompatibleChanges()} has been called.
+   * <p>Adding a required column without a default is an incompatible change 
that can break reading
+   * older data. To make this a compatible change, add a default value by 
calling {@link

Review Comment:
   It will cause writes without the required column to fail (as would adding an 
optional column), but it is a compatible change because you always know that 
the data can be read correctly. The incompatibility is when the NOT NULL 
constraint is violated because existing data has no 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-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