jackye1995 commented on code in PR #6179:
URL: https://github.com/apache/iceberg/pull/6179#discussion_r1021715987
##########
aws/src/main/java/org/apache/iceberg/aws/glue/GlueCatalog.java:
##########
@@ -624,4 +642,153 @@ public void setConf(Configuration conf) {
protected Map<String, String> properties() {
return catalogProperties == null ? ImmutableMap.of() : catalogProperties;
}
+
+ private void updateTableTag(TableIdentifier from, TableIdentifier to) {
+ // should update tag when the rename process is successful
+ TableOperations ops = newTableOps(to);
+ TableMetadata lastMetadata = null;
+ try {
+ lastMetadata = ops.current();
+ } catch (NotFoundException e) {
+ LOG.warn(
+ "Failed to load table metadata for table: {}, continuing rename
without re-tag", to, e);
+ }
+ Set<Tag> oldTags = Sets.newHashSet();
+ Set<Tag> newTags = Sets.newHashSet();
+ boolean skipNameValidation = awsProperties.glueCatalogSkipNameValidation();
+ if (awsProperties.s3WriteTableTagEnabled()) {
+ oldTags.add(
+ Tag.builder()
+ .key(AwsProperties.S3_TAG_ICEBERG_TABLE)
+ .value(IcebergToGlueConverter.getTableName(from,
skipNameValidation))
+ .build());
+ newTags.add(
+ Tag.builder()
+ .key(AwsProperties.S3_TAG_ICEBERG_TABLE)
+ .value(IcebergToGlueConverter.getTableName(to,
skipNameValidation))
+ .build());
+ }
+
+ if (awsProperties.s3WriteNamespaceTagEnabled()) {
+ oldTags.add(
+ Tag.builder()
+ .key(AwsProperties.S3_TAG_ICEBERG_NAMESPACE)
+ .value(IcebergToGlueConverter.getDatabaseName(from,
skipNameValidation))
+ .build());
+ newTags.add(
+ Tag.builder()
+ .key(AwsProperties.S3_TAG_ICEBERG_NAMESPACE)
+ .value(IcebergToGlueConverter.getDatabaseName(to,
skipNameValidation))
+ .build());
+ }
+
+ if (lastMetadata != null && ops.io() instanceof S3FileIO) {
Review Comment:
we should probably determine tag update upfront, based on FileIO used as
well as the flags in
https://github.com/apache/iceberg/blob/master/aws/src/main/java/org/apache/iceberg/aws/AwsProperties.java#L511-L526
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]