private void cleanupDir(Path eventsBasePath) {
    LOG.debug("Trying to delete expired proto events from " + eventsBasePath);
    try {
      FileSystem fs = FileSystem.get(eventsBasePath.toUri(), conf);
      if (!fs.exists(eventsBasePath)) {
        return;
      }
      FileStatus[] statuses = fs.listStatus(eventsBasePath, expiredDatePartitionsFilter);
      for (FileStatus dir : statuses) {
        try {
          deleteDirByOwner(fs, dir);
          LOG.info("Deleted expired proto events dir: " + dir.getPath());
        } catch (IOException ioe) {
          // Log error and continue to delete other expired dirs.
          LOG.error("Error deleting expired proto events dir " + dir.getPath(), ioe);
        }
      }
    } catch (IOException e) {
      LOG.error("Error while trying to delete expired proto events from " + eventsBasePath, e);
    }
  }
Finds the expired date partitioned events directory based on TTL and delete them.
metastore/src/java/org/apache/hadoop/hive/metastore/HiveProtoEventsCleanerTask.java