protected void checkPermissions(final Configuration conf, final Path path,
      final EnumSet<FsAction> actions) throws IOException, LoginException, HiveException {

    if (path == null) {
      throw new IllegalArgumentException("path is null");
    }

    if (userHasProxyPrivilege(authenticator.getUserName(), conf)) {
      LOG.info("Path authorization is skipped for path {}.", path);
      return;
    }

    final FileSystem fs = path.getFileSystem(conf);

    FileStatus pathStatus = FileUtils.getFileStatusOrNull(fs, path);
    if (pathStatus != null) {
      checkPermissions(fs, pathStatus, actions, authenticator.getUserName());
    } else if (path.getParent() != null) {
      // find the ancestor which exists to check its permissions
      Path par = path.getParent();
      FileStatus parStatus = null;
      while (par != null) {
        parStatus = FileUtils.getFileStatusOrNull(fs, par);
        if (parStatus != null) {
          break;
        }
        par = par.getParent();
      }

      checkPermissions(fs, parStatus, actions, authenticator.getUserName());
    }
  }
Checks the permissions for the given path and current user on Hadoop FS.
If the given path does not exists, it checks for its parent folder.
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/StorageBasedAuthorizationProvider.java