adutra commented on code in PR #4506:
URL: https://github.com/apache/polaris/pull/4506#discussion_r3303041404
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -305,14 +326,22 @@ public Table registerTable(TableIdentifier identifier,
String metadataFileLocati
"Invalid metadata file location; metadata file location must be
absolute and contain a '/': %s",
metadataFileLocation);
- // Throw an exception if this table already exists in the catalog.
- if (tableExists(identifier)) {
+ boolean tableExists = tableExists(identifier);
+ if (!overwrite && tableExists) {
throw alreadyExistsExceptionForTableLikeEntity(
identifier, PolarisEntitySubType.ICEBERG_TABLE);
}
String locationDir = metadataFileLocation.substring(0, lastSlashIndex);
+ if (tableExists) {
Review Comment:
FYI, we had a test explicitly testing that if overwrite is true but the
table doesn't exist, the register operation should behave as if overwrite is
false.
--
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]