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


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/generic/PolarisGenericTableCatalog.java:
##########
@@ -89,6 +101,43 @@ public GenericTableEntity createGenericTable(
               "Failed to fetch resolved parent for TableIdentifier '%s'", 
tableIdentifier));
     }
 
+    if (baseLocation != null && !baseLocation.isEmpty()) {
+      LOGGER.debug(
+          "Validating location and overlap for generic table '{}' at '{}'",
+          tableIdentifier,
+          baseLocation);
+      CatalogUtils.validateLocationForTableLike(
+          resolvedEntityView, callContext.getRealmConfig(), tableIdentifier, 
baseLocation);
+
+      CatalogEntity catalogEntity = 
resolvedEntityView.getResolvedCatalogEntity();
+      if (catalogEntity == null) {
+        throw new IllegalStateException(
+            String.format("Failed to resolve catalog entity for table '%s'", 
tableIdentifier));
+      }
+      RealmConfig realmConfig = callContext.getRealmConfig();
+      if (!realmConfig.getConfig(
+          FeatureConfiguration.ALLOW_TABLE_LOCATION_OVERLAP, catalogEntity)) {
+        LOGGER.debug("Validating no overlap with sibling tables or 
namespaces");
+        PolarisEntity lastParent = resolvedParent.getRawLeafEntity();
+        GenericTableEntity virtualEntity =
+            new GenericTableEntity.Builder(tableIdentifier, "")
+                .setCatalogId(catalogId)
+                .setParentId(lastParent.getId())
+                .setBaseLocation(baseLocation)
+                .build();
+        CatalogUtils.validateNoLocationOverlap(

Review Comment:
   Would it be possible to run the same tests with and without the "optimized" 
location check flag?



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