snazy commented on code in PR #4826:
URL: https://github.com/apache/iceberg/pull/4826#discussion_r885288933


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java:
##########
@@ -256,4 +263,31 @@ String currentRefName() {
   FileIO fileIO() {
     return fileIO;
   }
+
+  private class NessieCatalogTableBuilder extends 
BaseMetastoreCatalogTableBuilder {
+
+    private NessieCatalogTableBuilder(TableIdentifier identifier, Schema 
schema) {
+      super(identifier, schema);
+    }
+
+    @Override
+    public TableMetadata newTableMetadata() {
+      return updateLocation(super.newTableMetadata());
+    }
+
+    @Override
+    public TableMetadata replacedTableMetadata(TableOperations ops) {
+      return updateLocation(super.replacedTableMetadata(ops));
+    }
+
+    private TableMetadata updateLocation(TableMetadata tableMetadata) {
+      if (location() != null) {
+        // create the table at the location specified.
+        return tableMetadata;
+      }
+      // Different tables with same table name can exist across references in 
Nessie.
+      // To avoid sharing same table path between two tables with same name, 
use table uuid in the table path.
+      return tableMetadata.updateLocation(tableMetadata.location() + "_" + 
tableMetadata.uuid());

Review Comment:
   I'd really prefer a new, random UUID instead of the table's UUID.



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