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

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

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

FileUtils.getPathOrParentThatExists介绍

[英]Find the parent of path that exists, if path does not exist
[中]如果路径不存在,则查找存在路径的父级

代码示例

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

/**
 * Find the parent of path that exists, if path does not exist
 *
 * @param fs
 *          file system
 * @param path
 * @return FileStatus for argument path if it exists or the first ancestor in the path that exists
 * @throws IOException
 */
public static FileStatus getPathOrParentThatExists(FileSystem fs, Path path) throws IOException {
 FileStatus stat = FileUtils.getFileStatusOrNull(fs, path);
 if (stat != null) {
  return stat;
 }
 Path parentPath = path.getParent();
 return getPathOrParentThatExists(fs, parentPath);
}

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

boolean pickParent = (fileStatus == null); // did we find the file/dir itself?
if (pickParent){
 fileStatus = FileUtils.getPathOrParentThatExists(fs, filePath.getParent());

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

boolean pickParent = (fileStatus == null); // did we find the file/dir itself?
if (pickParent){
 fileStatus = FileUtils.getPathOrParentThatExists(fs, filePath.getParent());

代码示例来源:origin: com.facebook.presto.hive/hive-apache

/**
 * Find the parent of path that exists, if path does not exist
 *
 * @param fs
 *          file system
 * @param path
 * @return FileStatus for argument path if it exists or the first ancestor in the path that exists
 * @throws IOException
 */
public static FileStatus getPathOrParentThatExists(FileSystem fs, Path path) throws IOException {
 FileStatus stat = FileUtils.getFileStatusOrNull(fs, path);
 if (stat != null) {
  return stat;
 }
 Path parentPath = path.getParent();
 return getPathOrParentThatExists(fs, parentPath);
}

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

/**
 * Find the parent of path that exists, if path does not exist
 *
 * @param fs
 *          file system
 * @param path
 * @return FileStatus for argument path if it exists or the first ancestor in the path that exists
 * @throws IOException
 */
public static FileStatus getPathOrParentThatExists(FileSystem fs, Path path) throws IOException {
 FileStatus stat = FileUtils.getFileStatusOrNull(fs, path);
 if (stat != null) {
  return stat;
 }
 Path parentPath = path.getParent();
 return getPathOrParentThatExists(fs, parentPath);
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

try {
 fs = FileSystem.get(filePath.toUri(), conf);
 FileStatus fileStatus = FileUtils.getPathOrParentThatExists(fs, filePath);
 if (FileUtils.isOwnerOfFileHierarchy(fs, fileStatus, userName)) {
  availPrivs.addPrivilege(SQLPrivTypeGrant.OWNER_PRIV);

相关文章