private static boolean isPathEncrypted(Path path, HiveConf conf) throws HiveException {

    try {
      HadoopShims.HdfsEncryptionShim hdfsEncryptionShim =
          SessionState.get().getHdfsEncryptionShim(path.getFileSystem(conf), conf);
      if (hdfsEncryptionShim != null) {
        if (hdfsEncryptionShim.isPathEncrypted(path)) {
          return true;
        }
      }
    } catch (Exception e) {
      throw new HiveException("Unable to determine if " + path + " is encrypted: " + e, e);
    }

    return false;
  }
Checks if a given path is encrypted (valid only for HDFS files)
@param path The path to check for encryption
@return True if the path is encrypted; False if it is not encrypted
@throws HiveException If an error occurs while checking for encryption
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java