eric-maynard commented on code in PR #1037: URL: https://github.com/apache/polaris/pull/1037#discussion_r2013374612
########## service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandlerWrapper.java: ########## @@ -771,15 +810,113 @@ public boolean sendNotification(TableIdentifier identifier, NotificationRequest && notificationCatalog.sendNotification(identifier, request); } + /** + * Fetch the metastore table entity for the given table identifier + * + * @param tableIdentifier The identifier of the table + * @return the Polaris table entity for the table + */ + private IcebergTableLikeEntity getTableEntity(TableIdentifier tableIdentifier) { + PolarisResolvedPathWrapper target = + resolutionManifest.getPassthroughResolvedPath(tableIdentifier); + + return IcebergTableLikeEntity.of(target.getRawLeafEntity()); + } + + /** + * Hashes the provided metadata file location + * + * @param metadataFileLocation + * @return the hashed metadata file location + */ + private String hashMetadataFileLocation(String metadataFileLocation) { + return DigestUtils.sha256Hex(metadataFileLocation); + } + + /** + * Generate an ETag from a {@link LoadTableResponse} + * + * @param loadTableResponse the response for the operation + * @return the generated ETag + */ + private String generateETagValueForResponse(LoadTableResponse loadTableResponse) { + return generateETagForMetadataFileLocation(loadTableResponse.metadataLocation()); + } + + /** + * Generate an ETag from a {@link IcebergTableLikeEntity}. Useful when it is desired to generate + * an ETag without loading the entire metadata from storage. + * + * @param tableEntity the entity to use to generate the ETag + * @return the generated ETag + */ + private String generateETagValueForTableEntity(IcebergTableLikeEntity tableEntity) { Review Comment: This is a very thin function, could we inline it? ########## service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandlerWrapper.java: ########## @@ -771,15 +810,113 @@ public boolean sendNotification(TableIdentifier identifier, NotificationRequest && notificationCatalog.sendNotification(identifier, request); } + /** + * Fetch the metastore table entity for the given table identifier + * + * @param tableIdentifier The identifier of the table + * @return the Polaris table entity for the table + */ + private IcebergTableLikeEntity getTableEntity(TableIdentifier tableIdentifier) { + PolarisResolvedPathWrapper target = + resolutionManifest.getPassthroughResolvedPath(tableIdentifier); + + return IcebergTableLikeEntity.of(target.getRawLeafEntity()); + } + + /** + * Hashes the provided metadata file location + * + * @param metadataFileLocation + * @return the hashed metadata file location + */ + private String hashMetadataFileLocation(String metadataFileLocation) { + return DigestUtils.sha256Hex(metadataFileLocation); + } + + /** + * Generate an ETag from a {@link LoadTableResponse} + * + * @param loadTableResponse the response for the operation + * @return the generated ETag + */ + private String generateETagValueForResponse(LoadTableResponse loadTableResponse) { Review Comment: ditto ########## service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandlerWrapper.java: ########## @@ -771,15 +810,113 @@ public boolean sendNotification(TableIdentifier identifier, NotificationRequest && notificationCatalog.sendNotification(identifier, request); } + /** + * Fetch the metastore table entity for the given table identifier + * + * @param tableIdentifier The identifier of the table + * @return the Polaris table entity for the table + */ + private IcebergTableLikeEntity getTableEntity(TableIdentifier tableIdentifier) { + PolarisResolvedPathWrapper target = + resolutionManifest.getPassthroughResolvedPath(tableIdentifier); + + return IcebergTableLikeEntity.of(target.getRawLeafEntity()); + } + + /** + * Hashes the provided metadata file location + * + * @param metadataFileLocation + * @return the hashed metadata file location + */ + private String hashMetadataFileLocation(String metadataFileLocation) { Review Comment: ditto -- 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