@Deprecated
  public static String getDbAndTableNameForMetrics(Path path, boolean includeParts) {
    String[] parts = path.toUri().getPath().toString().split(Path.SEPARATOR);
    int dbIx = -1;
    // Try to find the default db postfix; don't check two last components - at least there
    // should be a table and file (we could also try to throw away partition/bucket/acid stuff).
    for (int i = 0; i < parts.length - 2; ++i) {
      if (!parts[i].endsWith(DATABASE_PATH_SUFFIX)) continue;
      if (dbIx >= 0) {
        dbIx = -1; // Let's not guess which one is correct.
        break;
      }
      dbIx = i;
    }
    if (dbIx >= 0) {
      String dbAndTable = parts[dbIx].substring(
          0, parts[dbIx].length() - 3) + "." + parts[dbIx + 1];
      if (!includeParts) return dbAndTable;
      for (int i = dbIx + 2; i < parts.length; ++i) {
        if (!parts[i].contains("=")) break;
        dbAndTable += "/" + parts[i];
      }
      return dbAndTable;
    }

    // Just go from the back and throw away everything we think is wrong; skip last item, the file.
    boolean isInPartFields = false;
    for (int i = parts.length - 2; i >= 0; --i) {
      String p = parts[i];
      boolean isPartField = p.contains("=");
      if ((isInPartFields && !isPartField) || (!isPartField && !isSomeHiveDir(p))) {
        dbIx = i - 1; // Assume this is the table we are at now.
        break;
      }
      isInPartFields = isPartField;
    }
    // If we found something before we ran out of components, use it.
    if (dbIx >= 0) {
      String dbName = parts[dbIx];
      if (dbName.endsWith(DATABASE_PATH_SUFFIX)) {
        dbName = dbName.substring(0, dbName.length() - 3);
      }
      String dbAndTable = dbName + "." + parts[dbIx + 1];
      if (!includeParts) return dbAndTable;
      for (int i = dbIx + 2; i < parts.length; ++i) {
        if (!parts[i].contains("=")) break;
        dbAndTable += "/" + parts[i];
      }
      return dbAndTable;
    }
    return "unknown";
  }
Login using kerberos and also updates the current logged in user

@param principal  - kerberos principal
@param keytabFile - keytab file
@throws IOException - if keytab file cannot be found
llap-common/src/java/org/apache/hadoop/hive/llap/LlapUtil.java