public static boolean isChildOfDelta(Path childDir, Path rootPath) {
    if (childDir.toUri().toString().length() <= rootPath.toUri().toString().length()) {
      return false;
    }
    // We do not want to look outside the original directory
    String fullName = childDir.toUri().toString().substring(rootPath.toUri().toString().length() + 1);
    String dirName = childDir.getName();
    return !dirName.startsWith(BASE_PREFIX) && !dirName.startsWith(DELTA_PREFIX) && !dirName.startsWith(DELETE_DELTA_PREFIX)
          && (fullName.contains(BASE_PREFIX) || fullName.contains(DELTA_PREFIX) || fullName.contains(DELETE_DELTA_PREFIX));
  }
In case of the cleaner, we don't need to go into file level, it is enough to collect base/delta/deletedelta directories.

@param fs the filesystem used for the directory lookup
@param path the path of the table or partition needs to be cleaned
@return The listed directory snapshot needs to be checked for cleaning
@throws IOException on filesystem errors
ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java