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


##########
core/src/main/java/org/apache/gravitino/catalog/CapabilityHelpers.java:
##########
@@ -629,6 +632,14 @@ private static void applyColumnDefaultValue(
         capabilities.columnDefaultValue().unsupportedMessage() + " Illegal 
column: " + columnName);
   }
 
+  private static void applyColumnInitialDefaultValue(
+      String columnName, Expression initialDefaultValue, Capability 
capabilities) {
+    Preconditions.checkArgument(
+        capabilities.columnDefaultValue().supported()

Review Comment:
   [minor] Reject unsupported initial defaults on create
   
   This uses the write-default capability to authorize `initialDefaultValue` as 
well. With `MysqlCatalogCapability`, a column whose only default is 
`initialDefaultValue="US"` passes `applyCapabilities`, but MySQL's generated 
`CREATE TABLE` SQL ignores it. For the current read-only scope, please reject 
non-unset initial defaults on create instead of accepting a value the catalog 
cannot apply.



##########
clients/client-python/gravitino/dto/rel/column_dto.py:
##########
@@ -65,6 +65,18 @@ class ColumnDTO(Column, DataClassJsonMixin):
     )
     """The default value of the column."""
 
+    _initial_default_value: Optional[Union[Expression, List[Expression]]] = 
field(

Review Comment:
   [minor] Preserve the existing positional constructor order
   
   Adding this field before `_nullable` changes the dataclass's generated 
constructor. I reproduced `ColumnDTO('id', Types.IntegerType.get(), None, 
Column.DEFAULT_VALUE_NOT_SET, False, True)` changing from `nullable=False, 
auto_increment=True` on the base to `nullable=True, auto_increment=False, 
initial_default_value=False` here; `to_json()` then raises `AttributeError: 
'bool' object has no attribute 'arg_type'`. Please place the new field after 
`_auto_increment` to keep existing positional calls compatible.



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