singhpk234 commented on code in PR #1285:
URL: https://github.com/apache/polaris/pull/1285#discussion_r2051117054


##########
service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -754,7 +769,199 @@ public LoadTableResponse updateTable(
     if (isStaticFacade(catalog)) {
       throw new BadRequestException("Cannot update table on static-facade 
external catalogs.");
     }
-    return CatalogHandlers.updateTable(baseCatalog, tableIdentifier, 
applyUpdateFilters(request));
+    // TODO: pending discussion if table property is right way, or a writer 
specific knob is
+    // required.
+    return updateTableWithRollback(baseCatalog, tableIdentifier, 
applyUpdateFilters(request));
+  }
+
+  private static TableMetadata create(TableOperations ops, UpdateTableRequest 
request) {
+    request.requirements().forEach((requirement) -> 
requirement.validate(ops.current()));
+    Optional<Integer> formatVersion =
+        request.updates().stream()
+            .filter((update) -> update instanceof 
MetadataUpdate.UpgradeFormatVersion)
+            .map((update) -> ((MetadataUpdate.UpgradeFormatVersion) 
update).formatVersion())
+            .findFirst();
+    TableMetadata.Builder builder =
+        (TableMetadata.Builder)
+            formatVersion
+                .map(TableMetadata::buildFromEmpty)
+                .orElseGet(TableMetadata::buildFromEmpty);
+    request.updates().forEach((update) -> update.applyTo(builder));
+    ops.commit((TableMetadata) null, builder.build());
+    return ops.current();
+  }
+
+  // TODO: Clean this up when CatalogHandler become extensible.
+  // Copy of CatalogHandler#update
+  private static LoadTableResponse updateTableWithRollback(

Review Comment:
   This is mostly taken 
[CatalogHandler#updateTable](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java#L342)
 and it calling 
[CatalogHandler#commit](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java#L409)
 which is protected, so they are exact same except the part of rollback-logic 



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