Copilot commented on code in PR #2043:
URL: https://github.com/apache/fluss/pull/2043#discussion_r2569724326
##########
fluss-lake/fluss-lake-iceberg/src/main/java/org/apache/fluss/lake/iceberg/IcebergLakeCatalog.java:
##########
@@ -119,8 +121,27 @@ public void createTable(TablePath tablePath,
TableDescriptor tableDescriptor, Co
@Override
public void alterTable(TablePath tablePath, List<TableChange>
tableChanges, Context context)
throws TableNotExistException {
- throw new UnsupportedOperationException(
- "Alter table is not supported for Iceberg at the moment");
+ try {
+ Table table =
icebergCatalog.loadTable(toIcebergTableIdentifier(tablePath));
+ UpdateProperties updateProperties = table.updateProperties();
+ for (TableChange tableChange : tableChanges) {
+ if (tableChange instanceof TableChange.SetOption) {
+ TableChange.SetOption option = (TableChange.SetOption)
tableChange;
+ updateProperties.set(
+ convertFlussPropertyKeyToIceberg(option.getKey()),
option.getValue());
+ } else if (tableChange instanceof TableChange.ResetOption) {
+ TableChange.ResetOption option = (TableChange.ResetOption)
tableChange;
+
updateProperties.remove(convertFlussPropertyKeyToIceberg(option.getKey()));
+ } else {
+ throw new UnsupportedOperationException(
+ "Unsupported table change: " +
tableChange.getClass());
+ }
+ }
+
+ updateProperties.commit();
+ } catch (TableNotExistException e) {
+ throw new TableNotExistException("Table " + tablePath + " not
exists.");
Review Comment:
The error message contains a grammatical error. It should be 'does not
exist' instead of 'not exists'.
```suggestion
throw new TableNotExistException("Table " + tablePath + " does
not exist.");
```
--
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]