private static boolean isPathWithinSubtree(Path path, Path subtree, int subtreeDepth) {
    while(path != null){
      if (subtreeDepth > path.depth()) {
        return false;
      }
      if(subtree.equals(path)){
        return true;
      }
      path = path.getParent();
    }
    return false;
  }
Checks whenever path is inside the given subtree

return true iff
 * path = subtree
 * subtreeContains(path,d) for any descendant of the subtree node
@param path    the path in question
@param subtree

@return
common/src/java/org/apache/hadoop/hive/common/FileUtils.java