jackye1995 commented on a change in pull request #4259:
URL: https://github.com/apache/iceberg/pull/4259#discussion_r821275302



##########
File path: aws/src/main/java/org/apache/iceberg/aws/glue/GlueCatalog.java
##########
@@ -162,7 +173,28 @@ private String cleanWarehousePath(String path) {
 
   @Override
   protected TableOperations newTableOps(TableIdentifier tableIdentifier) {
-    return new GlueTableOperations(glue, lockManager, catalogName, 
awsProperties, fileIO, tableIdentifier);
+    if (isS3FileIOConfigured()) {
+      // Create different S3FileIO to use different credentials in future
+      FileIO s3FileIO = new S3FileIO(toTags(tableIdentifier));
+      s3FileIO.initialize(this.catalogProperties);
+      closeableGroup.addCloseable(s3FileIO);
+      return new GlueTableOperations(glue, lockManager, catalogName, 
awsProperties, s3FileIO, tableIdentifier);
+    } else {
+      return new GlueTableOperations(glue, lockManager, catalogName, 
awsProperties, fileIO, tableIdentifier);
+    }
+  }
+
+  private boolean isS3FileIOConfigured() {

Review comment:
       having a specific case for S3FileIO should not be needed in a generic 
solution. `GlueCatalog` can just pass in the properties list to S3FileIO, and 
S3FileIO tries to parse any properties begin with `s3.write.tags` to gather all 
the tags needed.
   
   In the future, we might want to initialize a different S3FileIO for each 
`newTableOps` to have table-specific tags, but I think that's an enhancement we 
can do later, it would be much cleaner if we first offer the generic solution.




-- 
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]

Reply via email to