mchades commented on code in PR #14659:
URL: https://github.com/apache/gravitino/pull/14659#discussion_r4492798345


##########
api/src/main/java/org/apache/gravitino/rel/Column.java:
##########
@@ -78,10 +84,29 @@ public interface Column {
   boolean autoIncrement();
 
   /**
+   * Returns the write-time default value of this column.
+   *
+   * <p>For Iceberg format-version 3, this corresponds to {@code 
write-default}: the value writers
+   * fill in when a field is not supplied.
+   *
    * @return The default value of this column, {@link 
Column#DEFAULT_VALUE_NOT_SET} if not specified
    */
   Expression defaultValue();
 
+  /**
+   * Returns the initial default value of this column.
+   *
+   * <p>For Iceberg format-version 3, this corresponds to {@code 
initial-default}: the value assumed
+   * for rows written before the field was added. Catalogs that do not 
distinguish an initial
+   * default may leave this unset.

Review Comment:
   Please define the public `Column` semantics in provider-neutral terms first: 
`defaultValue()` is used for new records that omit the column; 
`initialDefaultValue()` is used when reading stored records that lack it, such 
as records written before the column was added. Present the Iceberg v3 mappings 
as examples (`For example, ...`) and keep the unset behavior explicit.



##########
docs/open-api/tables.yaml:
##########
@@ -390,6 +390,13 @@ components:
           default: true
         defaultValue:
           $ref: "#/components/schemas/ColumnDefaultValue"
+        initialDefaultValue:
+          allOf:
+            - $ref: "#/components/schemas/ColumnDefaultValue"
+          description: >
+            The initial default value of the column. For Iceberg 
format-version 3,
+            this maps to initial-default (assumed for rows written before the 
field
+            was added). defaultValue maps to write-default.

Review Comment:
   Please also update the “Table Column Default Value” section in 
`docs/tables-and-views.md`, which still describes only defaults applied to new 
rows. Since `initialDefaultValue` is now part of the public column model, 
document the two meanings, unset/unsupported behavior, and the current 
read-only restriction for initial defaults there. Align the OpenAPI 
descriptions with those generic semantics.



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

Reply via email to