org.apache.hadoop.hive.ql.exec.Utilities.realFile()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(92)

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

Utilities.realFile介绍

[英]Shamelessly cloned from GenericOptionsParser.
[中]不知羞耻地从GenericOptionsParser克隆。

代码示例

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

private static String validateFiles(Configuration conf, Set<String> files){
 if (files != null) {
  List<String> realFiles = new ArrayList<String>(files.size());
  for (String one : files) {
   try {
    String onefile = realFile(one, conf);
    if (onefile != null) {
     realFiles.add(realFile(one, conf));
    } else {
     LOG.warn("The file {} does not exist.", one);
    }
   } catch (IOException e) {
    throw new RuntimeException("Cannot validate file " + one + "due to exception: "
      + e.getMessage(), e);
   }
  }
  return StringUtils.join(realFiles, ",");
 } else {
  return StringUtils.EMPTY;
 }
}

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

static void validateFiles(List<String> newFiles) throws IllegalArgumentException {
 SessionState ss = SessionState.get();
 Configuration conf = (ss == null) ? new Configuration() : ss.getConf();
 for (String newFile : newFiles) {
  try {
   if (Utilities.realFile(newFile, conf) == null) {
    String message = newFile + " does not exist";
    throw new IllegalArgumentException(message);
   }
  } catch (IOException e) {
   String message = "Unable to validate " + newFile;
   throw new IllegalArgumentException(message, e);
  }
 }
}

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

static void validateFiles(List<String> newFiles) throws IllegalArgumentException {
 SessionState ss = SessionState.get();
 Configuration conf = (ss == null) ? new Configuration() : ss.getConf();
 for (String newFile : newFiles) {
  try {
   if (Utilities.realFile(newFile, conf) == null) {
    String message = newFile + " does not exist";
    throw new IllegalArgumentException(message);
   }
  } catch (IOException e) {
   String message = "Unable to validate " + newFile;
   throw new IllegalArgumentException(message, e);
  }
 }
}

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

public static String getResourceFiles(Configuration conf, SessionState.ResourceType t) {
 // fill in local files to be added to the task environment
 SessionState ss = SessionState.get();
 Set<String> files = (ss == null) ? null : ss.list_resource(t, null);
 if (files != null) {
  List<String> realFiles = new ArrayList<String>(files.size());
  for (String one : files) {
   try {
    String onefile = realFile(one, conf);
    if (onefile != null) {
     realFiles.add(realFile(one, conf));
    } else {
     LOG.warn("The file " + one + " does not exist.");
    }
   } catch (IOException e) {
    throw new RuntimeException("Cannot validate file " + one + "due to exception: "
      + e.getMessage(), e);
   }
  }
  return StringUtils.join(realFiles, ",");
 } else {
  return "";
 }
}

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

static void validateFiles(List<String> newFiles) throws IllegalArgumentException {
 SessionState ss = SessionState.get();
 Configuration conf = (ss == null) ? new Configuration() : ss.getConf();
 for (String newFile : newFiles) {
  try {
   if (Utilities.realFile(newFile, conf) == null) {
    String message = newFile + " does not exist";
    throw new IllegalArgumentException(message);
   }
  } catch (IOException e) {
   String message = "Unable to validate " + newFile;
   throw new IllegalArgumentException(message, e);
  }
 }
}

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

protected static String getResourceFiles(Configuration conf, SessionState.ResourceType t) {
 // fill in local files to be added to the task environment
 SessionState ss = SessionState.get();
 Set<String> files = (ss == null) ? null : ss.list_resource(t, null);
 if (files != null) {
  List<String> realFiles = new ArrayList<String>(files.size());
  for (String one : files) {
   try {
    realFiles.add(Utilities.realFile(one, conf));
   } catch (IOException e) {
    throw new RuntimeException("Cannot validate file " + one + "due to exception: "
      + e.getMessage(), e);
   }
  }
  return StringUtils.join(realFiles, ",");
 } else {
  return "";
 }
}

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

public static String getResourceFiles(Configuration conf, SessionState.ResourceType t) {
 // fill in local files to be added to the task environment
 SessionState ss = SessionState.get();
 Set<String> files = (ss == null) ? null : ss.list_resource(t, null);
 if (files != null) {
  List<String> realFiles = new ArrayList<String>(files.size());
  for (String one : files) {
   try {
    realFiles.add(realFile(one, conf));
   } catch (IOException e) {
    throw new RuntimeException("Cannot validate file " + one + "due to exception: "
      + e.getMessage(), e);
   }
  }
  return StringUtils.join(realFiles, ",");
 } else {
  return "";
 }
}

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

public static String validateFile(Set<String> curFiles, String newFile) {
 SessionState ss = SessionState.get();
 LogHelper console = getConsole();
 Configuration conf = (ss == null) ? new Configuration() : ss.getConf();
 try {
  if (Utilities.realFile(newFile, conf) != null) {
   return newFile;
  } else {
   console.printError(newFile + " does not exist");
   return null;
  }
 } catch (IOException e) {
  console.printError("Unable to validate " + newFile + "\nException: "
    + e.getMessage(), "\n"
    + org.apache.hadoop.util.StringUtils.stringifyException(e));
  return null;
 }
}

相关文章

微信公众号

最新文章

更多

Utilities类方法