szehon-ho commented on code in PR #17957:
URL: https://github.com/apache/iceberg/pull/17957#discussion_r4170631465


##########
spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkTable.java:
##########
@@ -158,6 +173,118 @@ public Set<TableCapability> capabilities() {
     return capabilities;
   }
 
+  @Override
+  public boolean supportsColumnChange(TableChange.ColumnChange change) {
+    if (isMapKeyChange(change)) {
+      return false;
+    }
+
+    if (change instanceof TableChange.AddColumn) {
+      TableChange.AddColumn add = (TableChange.AddColumn) change;
+      Type type = tryConvert(add.dataType());
+      return add.isNullable()
+          && add.defaultValue() == null
+          && type != null
+          && isSupportedAtFormatVersion(type);

Review Comment:
   Optional cleanup: return early for required columns or columns with 
defaults, avoiding type conversion for additions that will be rejected anyway.
   
   ```suggestion
         TableChange.AddColumn add = (TableChange.AddColumn) change;
         if (!add.isNullable() || add.defaultValue() != null) {
           return false;
         }
   
         Type type = tryConvert(add.dataType());
         return type != null && isSupportedAtFormatVersion(type);
   ```
   



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