rdblue commented on a change in pull request #1156:
URL: https://github.com/apache/iceberg/pull/1156#discussion_r451866335
##########
File path: core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java
##########
@@ -110,9 +110,17 @@ public Transaction newReplaceTableTransaction(
throw new NoSuchTableException("No such table: " + identifier);
}
- String baseLocation = location != null ? location :
defaultWarehouseLocation(identifier);
Map<String, String> tableProperties = properties != null ? properties :
Maps.newHashMap();
- TableMetadata metadata = TableMetadata.newTableMetadata(schema, spec,
baseLocation, tableProperties);
+
+ TableMetadata metadata;
+ if (ops.current() != null) {
Review comment:
I think this is correct because the `REPLACE TABLE` doesn't completely
wipe out the old table. In most ways, it is the same table.
Calling `buildReplacement` will replace the schema and partition spec so
that the transaction can add a new snapshot. Table history, old snapshots, and
existing table properties are kept so that you can inspect the table and don't
need to add table configuration every time you run the SQL.
We could add a flag to turn off this behavior and wipe out the old by
default, but I don't think that's what users really want. It makes sense for
things like default format and other settings to persist across replace
operations, so that table configuration and table operations are orthogonal.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]