adutra commented on code in PR #592:
URL: https://github.com/apache/polaris/pull/592#discussion_r1898040881


##########
service/common/src/main/java/org/apache/polaris/service/catalog/PolarisCatalogHandlerWrapper.java:
##########
@@ -184,14 +194,53 @@ public void close() throws IOException {
   }
 
   private void initializeCatalog() {
-    this.baseCatalog =
-        catalogFactory.createCallContextCatalog(
-            realmContext, authenticatedPrincipal, resolutionManifest);
+    PolarisBaseEntity baseCatalogEntity =
+        
resolutionManifest.getResolvedReferenceCatalogEntity().getRawLeafEntity();
+    CatalogEntity catalog = CatalogEntity.of(baseCatalogEntity);
+
+    String realm = realmContext.getRealmIdentifier();
+    String catalogKey = realm + "/" + catalogName;
+    LOGGER.info("Initializing new BasePolarisCatalog for key: {}", catalogKey);
+
+    Map<String, String> catalogProperties = new 
HashMap<>(catalog.getPropertiesAsMap());
+    String defaultBaseLocation = catalog.getDefaultBaseLocation();
+    LOGGER.info("Looked up defaultBaseLocation {} for catalog {}", 
defaultBaseLocation, catalogKey);
+    catalogProperties.put(
+        CatalogProperties.WAREHOUSE_LOCATION,
+        Objects.requireNonNullElseGet(
+            defaultBaseLocation,
+            () -> Paths.get(WAREHOUSE_LOCATION_BASEDIR, 
catalogKey).toString()));
+
+    this.baseCatalog = createBasePolarisCatalog(catalogProperties);
     this.namespaceCatalog =
         (baseCatalog instanceof SupportsNamespaces) ? (SupportsNamespaces) 
baseCatalog : null;
     this.viewCatalog = (baseCatalog instanceof ViewCatalog) ? (ViewCatalog) 
baseCatalog : null;
   }
 
+  private static final String WAREHOUSE_LOCATION_BASEDIR =
+      "/tmp/iceberg_rest_server_warehouse_data/";
+
+  @Nonnull
+  protected Catalog createBasePolarisCatalog(Map<String, String> 
catalogProperties) {

Review Comment:
   Protected method, in case some tests need to override it (not the case at 
the moment).



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