eric-maynard commented on code in PR #1686: URL: https://github.com/apache/polaris/pull/1686#discussion_r2116260506
########## 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: I don't think so, because we were just working with `PolarisEntity` before rather than the type-specific types -- 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: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org