org.apache.hadoop.hive.common.FileUtils.isPathWithinSubtree()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中org.apache.hadoop.hive.common.FileUtils.isPathWithinSubtree()方法的一些代码示例,展示了FileUtils.isPathWithinSubtree()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.isPathWithinSubtree()方法的具体详情如下:
包路径:org.apache.hadoop.hive.common.FileUtils
类名称:FileUtils
方法名:isPathWithinSubtree

FileUtils.isPathWithinSubtree介绍

[英]Checks whenever path is inside the given subtree return true iff * path = subtree * subtreeContains(path,d) for any descendant of the subtree node
[中]每当路径在给定子树内时进行检查,对于子树节点的任何子代,返回true iffpath=subtreesubtreeContains(path,d)

代码示例

代码示例来源:origin: apache/hive

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);
 }
}

代码示例来源:origin: apache/drill

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);
 }
}

代码示例来源:origin: apache/hive

/**
 * 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());
}

代码示例来源:origin: apache/hive

if (FileUtils.isPathWithinSubtree(path,hdfsTmpDir) || FileUtils.isPathWithinSubtree(path,localTmpDir)) {
 FileSystem fs = path.getFileSystem(conf);
 long fileSize = fs.getContentSummary(path).getLength();

代码示例来源:origin: apache/hive

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());

代码示例来源:origin: apache/hive

private void verifyIsPathWithInSubTree(Path splitPath, Path key, boolean expected) {
 boolean result = FileUtils.isPathWithinSubtree(splitPath, key);
 assertEquals("splitPath=" + splitPath + ", key=" + key, expected, result);
}

代码示例来源:origin: apache/drill

if (FileUtils.isPathWithinSubtree(path,hdfsTmpDir) || FileUtils.isPathWithinSubtree(path,localTmpDir)) {
 FileSystem fs = path.getFileSystem(conf);
 long fileSize = fs.getContentSummary(path).getLength();

代码示例来源:origin: apache/hive

@Test
public void isPathWithinSubtree_rootIsInside() {
 Path path = new Path("/foo");
 Path subtree = new Path("/foo");
 assertTrue(FileUtils.isPathWithinSubtree(path, subtree));
}

代码示例来源:origin: apache/hive

@Test
public void isPathWithinSubtree_samePrefix() {
 Path path = new Path("/somedir1");
 Path subtree = new Path("/somedir");
 assertFalse(FileUtils.isPathWithinSubtree(path, subtree));
}

代码示例来源:origin: apache/hive

@Test
public void isPathWithinSubtree_descendantInside() {
 Path path = new Path("/foo/bar");
 Path subtree = new Path("/foo");
 assertTrue(FileUtils.isPathWithinSubtree(path, subtree));
}

代码示例来源:origin: apache/hive

@Test
public void isPathWithinSubtree_relativeWalk() {
 Path path = new Path("foo/../../bar");
 Path subtree = new Path("../bar");
 assertTrue(FileUtils.isPathWithinSubtree(path, subtree));
}

代码示例来源:origin: apache/hive

match = FileUtils.isPathWithinSubtree(splitPath, key)
  || FileUtils.isPathWithinSubtree(splitPathWithNoSchema, key);

代码示例来源:origin: apache/drill

match = FileUtils.isPathWithinSubtree(splitPath, key)
  || FileUtils.isPathWithinSubtree(splitPathWithNoSchema, key);

代码示例来源:origin: apache/hive

List<Partition> partitions = Hive.get(hiveConf).getPartitions(table);
for (Partition partition : partitions) {
 boolean partitionLocOutsideTableLoc = !FileUtils.isPathWithinSubtree(
   partition.getDataLocation(), table.getDataLocation()
 );

代码示例来源:origin: org.apache.hive/hive-common

/**
 * 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());
}

相关文章