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

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

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

FileUtils.pathsContainNoScheme介绍

[英]Return whenever all paths in the collection are schemaless
[中]每当集合中的所有路径都是无模式时返回

代码示例

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

public static <T> T getFromPathRecursively(Map<Path, T> pathToPartitionInfo, Path dir,
  Map<Map<Path, T>, Map<Path, T>> cacheMap, boolean ignoreSchema, boolean ifPresent)
    throws IOException {
 T part = getFromPath(pathToPartitionInfo, dir);
 if (part == null
   && (ignoreSchema
     || (dir.toUri().getScheme() == null || dir.toUri().getScheme().trim().equals(""))
     || FileUtils.pathsContainNoScheme(pathToPartitionInfo.keySet()))) {
  Map<Path, T> newPathToPartitionInfo = null;
  if (cacheMap != null) {
   newPathToPartitionInfo = cacheMap.get(pathToPartitionInfo);
  }
  if (newPathToPartitionInfo == null) { // still null
   newPathToPartitionInfo = populateNewT(pathToPartitionInfo);
   if (cacheMap != null) {
    cacheMap.put(pathToPartitionInfo, newPathToPartitionInfo);
   }
  }
  part = getFromPath(newPathToPartitionInfo, dir);
 }
 if (part != null || ifPresent) {
  return part;
 } else {
  throw new IOException("cannot find dir = " + dir.toString()
            + " in pathToPartitionInfo: " + pathToPartitionInfo.keySet());
 }
}

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

public static PartitionDesc getPartitionDescFromPathRecursively(
  Map<Path, PartitionDesc> pathToPartitionInfo, Path dir,
  Map<Map<Path, PartitionDesc>, Map<Path, PartitionDesc>> cacheMap, boolean ignoreSchema)
    throws IOException {
 PartitionDesc part = doGetPartitionDescFromPath(pathToPartitionInfo, dir);
 if (part == null
   && (ignoreSchema
     || (dir.toUri().getScheme() == null || dir.toUri().getScheme().trim().equals(""))
     || FileUtils.pathsContainNoScheme(pathToPartitionInfo.keySet()))) {
  Map<Path, PartitionDesc> newPathToPartitionInfo = null;
  if (cacheMap != null) {
   newPathToPartitionInfo = cacheMap.get(pathToPartitionInfo);
  }
  if (newPathToPartitionInfo == null) { // still null
   newPathToPartitionInfo = populateNewPartitionDesc(pathToPartitionInfo);
   if (cacheMap != null) {
    cacheMap.put(pathToPartitionInfo, newPathToPartitionInfo);
   }
  }
  part = doGetPartitionDescFromPath(newPathToPartitionInfo, dir);
 }
 if (part != null) {
  return part;
 } else {
  throw new IOException("cannot find dir = " + dir.toString()
            + " in pathToPartitionInfo: " + pathToPartitionInfo.keySet());
 }
}

相关文章