adnanhemani commented on code in PR #1686:
URL: https://github.com/apache/polaris/pull/1686#discussion_r2117694356
##########
service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -2168,26 +2207,48 @@ private void createTableLike(TableIdentifier
identifier, PolarisEntity entity) {
private void createTableLike(
TableIdentifier identifier, PolarisEntity entity,
PolarisResolvedPathWrapper resolvedParent) {
+ IcebergTableLikeEntity icebergTableLikeEntity =
IcebergTableLikeEntity.of(entity);
+ // Set / suffix
+ boolean requireTrailingSlash =
+ callContext
+ .getPolarisCallContext()
+ .getConfigurationStore()
+ .getConfiguration(
+ callContext.getPolarisCallContext(),
+ FeatureConfiguration.ADD_TRAILING_SLASH_TO_LOCATION);
+ if (requireTrailingSlash
+ && icebergTableLikeEntity.getBaseLocation() != null
+ && !icebergTableLikeEntity.getBaseLocation().endsWith("/")) {
+ icebergTableLikeEntity =
+ new IcebergTableLikeEntity.Builder(icebergTableLikeEntity)
+ .setBaseLocation(icebergTableLikeEntity.getBaseLocation() + "/")
+ .build();
+ }
+
// Make sure the metadata file is valid for our allowed locations.
- String metadataLocation =
IcebergTableLikeEntity.of(entity).getMetadataLocation();
+ String metadataLocation = icebergTableLikeEntity.getMetadataLocation();
validateLocationForTableLike(identifier, metadataLocation, resolvedParent);
List<PolarisEntity> catalogPath = resolvedParent.getRawFullPath();
- if (entity.getParentId() <= 0) {
+ if (icebergTableLikeEntity.getParentId() <= 0) {
// TODO: Validate catalogPath size is at least 1 for catalog entity?
- entity =
- new PolarisEntity.Builder(entity)
+ icebergTableLikeEntity =
+ new IcebergTableLikeEntity.Builder(icebergTableLikeEntity)
.setParentId(resolvedParent.getRawLeafEntity().getId())
.build();
}
- entity =
- new
PolarisEntity.Builder(entity).setCreateTimestamp(System.currentTimeMillis()).build();
+ icebergTableLikeEntity =
Review Comment:
Went over this offline with @eric-maynard, I don't think there's a good way
to make this happen due to the object being immutable.
--
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]