MonkeyCanCode commented on code in PR #4606:
URL: https://github.com/apache/polaris/pull/4606#discussion_r3368656687
##########
polaris-core/src/main/java/org/apache/polaris/core/config/FeatureConfiguration.java:
##########
@@ -551,6 +565,18 @@ public static void enforceFeatureEnabledOrThrow(
.defaultValue(false)
.buildFeatureConfiguration();
+ public static final FeatureConfiguration<Boolean>
DEFAULT_TABLE_LOCATION_USE_UUID =
+ PolarisConfiguration.<Boolean>builder()
+ .key("DEFAULT_TABLE_LOCATION_USE_UUID")
Review Comment:
So we have `DEFAULT_LOCATION_OBJECT_STORAGE_PREFIX_ENABLED`
(https://github.com/apache/polaris/blob/4c6bffbc19afc70d5dd6e3940d949a06c2c5b140/polaris-core/src/main/java/org/apache/polaris/core/config/FeatureConfiguration.java#L541)
which add prefix to the object, should we stick with this naming rule instead
of using "random"?
##########
polaris-core/src/main/java/org/apache/polaris/core/config/FeatureConfiguration.java:
##########
@@ -287,6 +287,20 @@ public static void enforceFeatureEnabledOrThrow(
.defaultValue(false)
.buildFeatureConfiguration();
+ public static final FeatureConfiguration<Boolean>
ALLOW_CLIENT_SPECIFIED_TABLE_LOCATION =
+ PolarisConfiguration.<Boolean>builder()
+ .key("ALLOW_CLIENT_SPECIFIED_TABLE_LOCATION")
+
.catalogConfig("polaris.config.allow.client-specified.table.location")
+ .description(
+ "If set to true, Polaris honors a `location` (and the
`write.data.path` / "
+ + "`write.metadata.path` properties) explicitly supplied in
a create-table or "
+ + "create-view request (subject to the usual
allowed-location and overlap "
+ + "validation). If set to false (the default), such a
request is rejected and "
+ + "Polaris always generates the managed location. "
+ + "See DEFAULT_TABLE_LOCATION_USE_UUID.")
+ .defaultValue(false)
Review Comment:
+1
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -469,9 +469,14 @@ protected String defaultWarehouseLocation(TableIdentifier
tableIdentifier) {
throw noSuchNamespaceException(tableIdentifier.namespace());
}
List<PolarisEntity> namespacePath = resolvedNamespace.getRawFullPath();
- String namespaceLocation = resolveLocationForPath(diagnostics,
namespacePath);
- return SLASH.join(namespaceLocation, tableIdentifier.name());
+ namespaceLocation = resolveLocationForPath(diagnostics, namespacePath);
}
+ String location = SLASH.join(namespaceLocation, tableIdentifier.name());
+ if (realmConfig.getConfig(
+ FeatureConfiguration.DEFAULT_TABLE_LOCATION_USE_UUID, catalogEntity)) {
+ location = location + "-" + UUID.randomUUID();
Review Comment:
Minor: should we avoid dash in the uuid? Same been performed in iceberg:
https://github.com/davseitsev/iceberg/blob/main/core/src/main/java/org/apache/iceberg/util/LocationUtil.java#L54
It would be cleaner this way (also shorter) to distinguish between table
name and uuid part in case if table name contains dash.
--
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]