private static Path getStrongestEncryptedTablePath(QB qb, HiveConf conf) throws HiveException {
    List<String> tabAliases = new ArrayList<String>(qb.getTabAliases());
    Path strongestPath = null;

    /* Walk through all found table locations to get the most encrypted table */
    for (String alias : tabAliases) {
      Table tab = qb.getMetaData().getTableForAlias(alias);
      if (tab != null) {
        Path tablePath = tab.getDataLocation();
        if (tablePath != null) {
          if ("hdfs".equalsIgnoreCase(tablePath.toUri().getScheme())) {
            if (isPathEncrypted(tablePath, conf)) {
              if (strongestPath == null) {
                strongestPath = tablePath;
              } else if (comparePathKeyStrength(tablePath, strongestPath, conf) > 0) {
                strongestPath = tablePath;
              }
            }
          }
        }
      }
    }

    return strongestPath;
  }
Gets the strongest encrypted table path.

@param qb The QB object that contains a list of all table locations.
@return The strongest encrypted path. It may return NULL if there are not tables encrypted, or are not HDFS tables.
@throws HiveException if an error occurred attempting to compare the encryption strength
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java