public static String getUserFromAuthenticator() {
    if (SessionState.get() != null && SessionState.get().getAuthenticator() != null) {
      return SessionState.get().getAuthenticator().getUserName();
    }
    return null;
  }
@return username from current SessionState authenticator. username will be
        null if there is no current SessionState object or authenticator is
        null.
ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java