RussellSpitzer commented on code in PR #5327:
URL: https://github.com/apache/iceberg/pull/5327#discussion_r930508324


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -235,19 +235,21 @@ public void renameTable(TableIdentifier from, 
TableIdentifier originalTo) {
   }
 
   @Override
-  public org.apache.iceberg.Table registerTable(TableIdentifier identifier, 
String metadataFileLocation) {
+  public org.apache.iceberg.Table registerTable(TableIdentifier identifier,
+      String metadataFileLocation, boolean force) {
     Preconditions.checkArgument(isValidIdentifier(identifier), "Invalid 
identifier: %s", identifier);
 
-    // Throw an exception if this table already exists in the catalog.
-    if (tableExists(identifier)) {
+    // Throw an exception if this table already exists in the catalog and no 
force option.
+    if (tableExists(identifier) && !force) {
       throw new org.apache.iceberg.exceptions.AlreadyExistsException("Table 
already exists: %s", identifier);
     }
+    HiveTableOperations ops = (HiveTableOperations) newTableOps(identifier);
+    TableMetadata base = ops.current();

Review Comment:
   I'm not sure we should go through the operation.commit pathway here. Feels 
like what we are doing here is different than every other kind of commit. 
Really all we want to do is transactionally swap one parameter for another. I'm 
gonna think more about this tomorrow



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