private boolean pathIsInPartition(Path split, Path partitionPath) { boolean schemeless = split.toUri().getScheme() == null; if (schemeless) { Path pathNoSchema = Path.getPathWithoutSchemeAndAuthority(partitionPath); return FileUtils.isPathWithinSubtree(split,pathNoSchema); } else { return FileUtils.isPathWithinSubtree(split,partitionPath); } }
private boolean pathIsInPartition(Path split, Path partitionPath) { boolean schemeless = split.toUri().getScheme() == null; if (schemeless) { Path pathNoSchema = Path.getPathWithoutSchemeAndAuthority(partitionPath); return FileUtils.isPathWithinSubtree(split,pathNoSchema); } else { return FileUtils.isPathWithinSubtree(split,partitionPath); } }
/** * 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 */ public static boolean isPathWithinSubtree(Path path, Path subtree) { return isPathWithinSubtree(path, subtree, subtree.depth()); }
if (FileUtils.isPathWithinSubtree(path,hdfsTmpDir) || FileUtils.isPathWithinSubtree(path,localTmpDir)) { FileSystem fs = path.getFileSystem(conf); long fileSize = fs.getContentSummary(path).getLength();
filesToDelete.add(stat.getPath()); extraDebugInfo.append(stat.getPath().getName()).append(","); if(!FileUtils.isPathWithinSubtree(stat.getPath(), locPath)) { LOG.info(idWatermark(ci) + " found unexpected file: " + stat.getPath());
private void verifyIsPathWithInSubTree(Path splitPath, Path key, boolean expected) { boolean result = FileUtils.isPathWithinSubtree(splitPath, key); assertEquals("splitPath=" + splitPath + ", key=" + key, expected, result); }
if (FileUtils.isPathWithinSubtree(path,hdfsTmpDir) || FileUtils.isPathWithinSubtree(path,localTmpDir)) { FileSystem fs = path.getFileSystem(conf); long fileSize = fs.getContentSummary(path).getLength();
@Test public void isPathWithinSubtree_rootIsInside() { Path path = new Path("/foo"); Path subtree = new Path("/foo"); assertTrue(FileUtils.isPathWithinSubtree(path, subtree)); }
@Test public void isPathWithinSubtree_samePrefix() { Path path = new Path("/somedir1"); Path subtree = new Path("/somedir"); assertFalse(FileUtils.isPathWithinSubtree(path, subtree)); }
@Test public void isPathWithinSubtree_descendantInside() { Path path = new Path("/foo/bar"); Path subtree = new Path("/foo"); assertTrue(FileUtils.isPathWithinSubtree(path, subtree)); }
@Test public void isPathWithinSubtree_relativeWalk() { Path path = new Path("foo/../../bar"); Path subtree = new Path("../bar"); assertTrue(FileUtils.isPathWithinSubtree(path, subtree)); }
match = FileUtils.isPathWithinSubtree(splitPath, key) || FileUtils.isPathWithinSubtree(splitPathWithNoSchema, key);
match = FileUtils.isPathWithinSubtree(splitPath, key) || FileUtils.isPathWithinSubtree(splitPathWithNoSchema, key);
List<Partition> partitions = Hive.get(hiveConf).getPartitions(table); for (Partition partition : partitions) { boolean partitionLocOutsideTableLoc = !FileUtils.isPathWithinSubtree( partition.getDataLocation(), table.getDataLocation() );
/** * 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 */ public static boolean isPathWithinSubtree(Path path, Path subtree) { return isPathWithinSubtree(path, subtree, subtree.depth()); }