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

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

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

FileUtils.getURI介绍

[英]Get the URI of the path. Assume to be local file system if no scheme.
[中]获取路径的URI。如果没有方案,则假定为本地文件系统。

代码示例

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

private void addResources(String addedFiles) throws IOException {
 for (String addedFile : CSV_SPLITTER.split(Strings.nullToEmpty(addedFiles))) {
  try {
   URI fileUri = FileUtils.getURI(addedFile);
   if (fileUri != null && !localFiles.contains(fileUri)) {
    localFiles.add(fileUri);
    if (SparkUtilities.needUploadToHDFS(fileUri, sparkConf)) {
     fileUri = SparkUtilities.uploadToHDFS(fileUri, hiveConf);
    }
    remoteClient.addFile(fileUri);
   }
  } catch (URISyntaxException e) {
   LOG.warn("Failed to add file:" + addedFile, e);
  }
 }
}

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

private void addJars(String addedJars) throws IOException {
 for (String addedJar : CSV_SPLITTER.split(Strings.nullToEmpty(addedJars))) {
  try {
   URI jarUri = FileUtils.getURI(addedJar);
   if (jarUri != null && !localJars.contains(jarUri)) {
    localJars.add(jarUri);
    if (SparkUtilities.needUploadToHDFS(jarUri, sparkConf)) {
     jarUri = SparkUtilities.uploadToHDFS(jarUri, hiveConf);
    }
    remoteClient.addJar(jarUri);
   }
  } catch (URISyntaxException e) {
   LOG.warn("Failed to add jar:" + addedJar, e);
  }
 }
}

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

for (final String path : paths) {
 try {
  Path p = new Path(getURI(path));
  FileSystem fs = p.getFileSystem(conf);
  FileStatus fileStatus = fs.getFileStatus(p);

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

private void addJars(String addedJars) throws IOException {
 for (String addedJar : CSV_SPLITTER.split(Strings.nullToEmpty(addedJars))) {
  try {
   URI jarUri = FileUtils.getURI(addedJar);
   if (jarUri != null && !localJars.contains(jarUri)) {
    localJars.add(jarUri);
    if (SparkUtilities.needUploadToHDFS(jarUri, sparkConf)) {
     jarUri = SparkUtilities.uploadToHDFS(jarUri, hiveConf);
    }
    remoteClient.addJar(jarUri);
   }
  } catch (URISyntaxException e) {
   LOG.warn("Failed to add jar:" + addedJar, e);
  }
 }
}

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

private void addResources(String addedFiles) throws IOException {
 for (String addedFile : CSV_SPLITTER.split(Strings.nullToEmpty(addedFiles))) {
  try {
   URI fileUri = FileUtils.getURI(addedFile);
   if (fileUri != null && !localFiles.contains(fileUri)) {
    localFiles.add(fileUri);
    if (SparkUtilities.needUploadToHDFS(fileUri, sparkConf)) {
     fileUri = SparkUtilities.uploadToHDFS(fileUri, hiveConf);
    }
    remoteClient.addFile(fileUri);
   }
  } catch (URISyntaxException e) {
   LOG.warn("Failed to add file:" + addedFile, e);
  }
 }
}

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

for(String path : paths) {
 try {
  Path p = new Path(getURI(path));
  FileSystem fs = p.getFileSystem(conf);
  if (!fs.exists(p)) {

相关文章