diff --git common/src/java/org/apache/hadoop/hive/common/FileUtils.java common/src/java/org/apache/hadoop/hive/common/FileUtils.java index 1d8c041..2f2f4e8 100644 --- common/src/java/org/apache/hadoop/hive/common/FileUtils.java +++ common/src/java/org/apache/hadoop/hive/common/FileUtils.java @@ -912,11 +912,18 @@ public static Path getParentRegardlessOfScheme(Path path, Collection candi * @return */ public static boolean isPathWithinSubtree(Path path, Path subtree) { - while(path!=null){ + return isPathWithinSubtree(path, subtree, subtree.depth()); + } + + 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(); + path = path.getParent(); } return false; }