private void deleteDirByOwner(FileSystem fs, FileStatus eventsDir) throws IOException {
    String owner = eventsDir.getOwner();
    if (owner.equals(System.getProperty("user.name"))) {
      fs.delete(eventsDir.getPath(), true);
    } else {
      LOG.info("Deleting " + eventsDir.getPath() + " as user " + owner);
      UserGroupInformation ugi = UserGroupInformation.createProxyUser(owner,
              UserGroupInformation.getLoginUser());
      try {
        ugi.doAs(new PrivilegedExceptionAction<Object>() {
          @Override
          public Object run() throws Exception {
            // New FileSystem object to be obtained in user context for doAs flow.
            try (FileSystem doAsFs = FileSystem.newInstance(eventsDir.getPath().toUri(), conf)) {
              doAsFs.delete(eventsDir.getPath(), true);
            }
            return null;
          }
        });
      } catch (InterruptedException ie) {
        LOG.error("Could not delete " + eventsDir.getPath() + " for UGI: " + ugi, ie);
      }
    }
  }
Delete the events dir with it's owner as proxy user.
metastore/src/java/org/apache/hadoop/hive/metastore/HiveProtoEventsCleanerTask.java