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


##########
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);
+    } else if (change instanceof TableChange.UpdateColumnType) {
+      return supportsTypeUpdate((TableChange.UpdateColumnType) change);
+    } else if (change instanceof TableChange.UpdateColumnNullability) {
+      return supportsNullabilityUpdate((TableChange.UpdateColumnNullability) 
change);
+    } else if (change instanceof TableChange.DeleteColumn) {
+      return supportsDeleteColumn((TableChange.DeleteColumn) change);
+    } else {
+      return change instanceof TableChange.RenameColumn
+          || change instanceof TableChange.UpdateColumnComment
+          || change instanceof TableChange.UpdateColumnPosition;
+    }
+  }
+
+  private Set<Integer> mapKeyFieldIds() {

Review Comment:
   Could we make this accessor `synchronized`, or declare `mapKeyFieldIds` 
`volatile`, so the initialized set is safely published if the same `SparkTable` 
is accessed concurrently? With the plain field, another thread is not 
guaranteed to see all of the `HashSet` contents. `volatile` is sufficient if 
duplicate initialization is acceptable, since the computed set is never mutated 
afterward.



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