danielcweeks commented on a change in pull request #4050:
URL: https://github.com/apache/iceberg/pull/4050#discussion_r808297173



##########
File path: aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIO.java
##########
@@ -104,8 +112,23 @@ private S3Client client() {
   @Override
   public void initialize(Map<String, String> properties) {
     this.awsProperties = new AwsProperties(properties);
-    this.awsClientFactory = AwsClientFactories.from(properties);
-    this.s3 = awsClientFactory::s3;
+
+    // Do not override s3 client if it was provided
+    if (s3 == null) {
+      this.s3 = AwsClientFactories.from(properties)::s3;
+    }
+
+    // Report Hadoop metrics if Hadoop is available
+    try {
+      Class<? extends MetricsContext> clazz = 
DynClasses.builder().impl(DEFAULT_METRICS_IMPL).buildChecked();
+
+      this.metrics = clazz.getDeclaredConstructor().newInstance();
+      metrics.initialize(ImmutableMap.of("fileio.scheme", "s3"));

Review comment:
       I think I can address both of these issue.  I'll pass S3 to the 
constructor, but also allow for overriding.  I think this is going to be a 
rather rare case where someone needs to override (even if they're using a 
different scheme, it's largely just bundled up under hadoop statistics in most 
frameworks).  




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