You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/11/11 07:31:20 UTC

[GitHub] [iceberg] nastra commented on a diff in pull request #6175: Hive: Add UGI to the key in CachedClientPool

nastra commented on code in PR #6175:
URL: https://github.com/apache/iceberg/pull/6175#discussion_r1019948958


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/CachedClientPool.java:
##########
@@ -87,4 +92,50 @@ public <R> R run(Action<R, IMetaStoreClient, TException> action, boolean retry)
       throws TException, InterruptedException {
     return clientPool().run(action, retry);
   }
+
+  @VisibleForTesting

Review Comment:
   this could be simplified to:
   ```
   @VisibleForTesting
     @Value.Immutable
     abstract static class Key {
       abstract String metastoreUri();
   
       abstract UserGroupInformation ugi();
   
       static Key of(String metastoreUri) {
         try {
           return ImmutableKey.builder()
               .metastoreUri(metastoreUri)
               .ugi(UserGroupInformation.getCurrentUser())
               .build();
         } catch (IOException e) {
           throw new UncheckedIOException("Failed to get current user", e);
         }
       }
     }
   ```
   
   You'll just need to add this compile-time dependency
   ```
   diff --git a/build.gradle b/build.gradle
   index e5ab7377b..feb2e5acc 100644
   --- a/build.gradle
   +++ b/build.gradle
   @@ -459,6 +459,8 @@ project(':iceberg-hive-metastore') {
        implementation project(':iceberg-core')
        api project(':iceberg-api')
        implementation project(':iceberg-common')
   +    annotationProcessor "org.immutables:value"
   +    compileOnly "org.immutables:value"
    
        implementation "com.github.ben-manes.caffeine:caffeine"
   ```
   
   And then you'd adjust the places where `Key` is being used to `Key.of(...`)



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org