yabola commented on code in PR #5327:
URL: https://github.com/apache/iceberg/pull/5327#discussion_r929429419
##########
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:
If pass in base, we can change the `commit` method less, otherwise, the
logic of commit checking meta will be incorrect. `commit` method means changing
table meta from base to newMeta. I think this is good for maintaining the
existing 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]