dimas-b commented on code in PR #4023:
URL: https://github.com/apache/polaris/pull/4023#discussion_r2982695247


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -520,15 +534,35 @@ private void createNamespaceInternal(
       baseLocation += "/";
     }
 
-    NamespaceEntity entity =
+    enforceStorageNameOverrideEnabledIfRequested(metadata);
+
+    PolarisStorageConfigurationInfo namespaceStorageConfig =
+        storageConfigFromPropertyOverride(metadata, 
resolvedParent.getRawFullPath());
+
+    NamespaceEntity.Builder nsBuilder =
         new NamespaceEntity.Builder(namespace)
             .setCatalogId(getCatalogId())
             
.setId(getMetaStoreManager().generateNewEntityId(getCurrentPolarisContext()).getId())
             .setParentId(resolvedParent.getRawLeafEntity().getId())
             .setProperties(metadata)
             .setCreateTimestamp(System.currentTimeMillis())
-            .setBaseLocation(baseLocation)
-            .build();
+            .setBaseLocation(baseLocation);
+    NamespaceEntity entity;
+    if (namespaceStorageConfig != null) {
+      LOGGER.debug(
+          "Applying storage name override '{}' on namespace {}",
+          namespaceStorageConfig.getStorageName(),
+          namespace);
+      entity =
+          new NamespaceEntity(
+              new PolarisEntity.Builder(nsBuilder.build())
+                  .addInternalProperty(
+                      
PolarisEntityConstants.getStorageConfigInfoPropertyName(),
+                      namespaceStorageConfig.serialize())

Review Comment:
   Why embed a copy of the config into the entity here? 
   
   Based on previous `dev` discussion (link below) my impression is that we'd 
want to keep (named) storage configs at the catalog level for ease of 
management.
   
   https://lists.apache.org/thread/nwcc8krhvm35olgc22676mm12cjkpgn5
   
   I'd expect entities to only reference storage config by name, and the config 
resolution to happen when requested 🤔 



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

Reply via email to