Github user mridulm commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21178#discussion_r184625977
  
    --- Diff: 
sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java
 ---
    @@ -362,4 +371,34 @@ public static void verifyProxyAccess(String realUser, 
String proxyUser, String i
         }
       }
     
    +  public static boolean needUgiLogin(UserGroupInformation ugi, String 
principal, String keytab) {
    +    return null == ugi || !ugi.hasKerberosCredentials() || 
!ugi.getUserName().equals(principal) ||
    +      !keytab.equals(getKeytabFromUgi());
    +  }
    +
    +  private static String getKeytabFromUgi() {
    +    Class<?> clz = UserGroupInformation.class;
    +    try {
    +      synchronized (clz) {
    +        Field field = clz.getDeclaredField("keytabFile");
    --- End diff --
    
    The field lookup + setAccessible can be pulled out of the method and into a 
static variable.
    The field.get() itself should be within the sync block.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to