bryanck commented on code in PR #5199:
URL: https://github.com/apache/iceberg/pull/5199#discussion_r917189767


##########
core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java:
##########
@@ -282,20 +283,77 @@ private static boolean isCreate(UpdateTableRequest 
request) {
     return isCreate;
   }
 
-  private static TableMetadata create(TableOperations ops, TableMetadata 
start, UpdateTableRequest request) {
+  private static TableMetadata commitUpdate(Catalog catalog, TableIdentifier 
ident, UpdateTableRequest request) {
+    Table table = catalog.loadTable(ident);
+    if (table instanceof BaseTable) {
+      TableOperations ops = ((BaseTable) table).operations();
+      return commit(ops, request.requirements(), request.updates());
+    } else {
+      throw new IllegalStateException("Cannot wrap catalog that does not 
produce BaseTable");
+    }
+  }
+
+  private static TableMetadata commitCreate(Catalog catalog, TableIdentifier 
ident, UpdateTableRequest request) {
+    // this is a hacky way to get TableOperations for an uncommitted table
+    Transaction transaction = catalog.buildTable(ident, 
EMPTY_SCHEMA).createOrReplaceTransaction();

Review Comment:
   I made this change. Filtering out the setter types with ID of -1 wasn't 
working, I changed that to filter those out only if an associated add type is 
pending. I also added a test that adds 2 files, each associated with a 
different schema, spec, and sort order.



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