private String getUserNameForGroups(SessionState ss) {
    // This should be removed when authenticator and the 2-username mess is cleaned up.
    if (ss.getAuthenticator() != null) {
      String userName = ss.getAuthenticator().getUserName();
      if (userName != null) return userName;
    }
    return ss.getUserName();
  }
Making TezTask backward compatible with the old MR-based Task API (ExecDriver/MapRedTask)
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java