當前位置: 首頁>>代碼示例>>Java>>正文


Java ContentSummary.getFileCount方法代碼示例

本文整理匯總了Java中org.apache.hadoop.fs.ContentSummary.getFileCount方法的典型用法代碼示例。如果您正苦於以下問題:Java ContentSummary.getFileCount方法的具體用法?Java ContentSummary.getFileCount怎麽用?Java ContentSummary.getFileCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.fs.ContentSummary的用法示例。


在下文中一共展示了ContentSummary.getFileCount方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canBeSafelyDeleted

import org.apache.hadoop.fs.ContentSummary; //導入方法依賴的package包/類
private boolean canBeSafelyDeleted(PathData item)
    throws IOException {
  boolean shouldDelete = true;
  if (safeDelete) {
    final long deleteLimit = getConf().getLong(
        HADOOP_SHELL_SAFELY_DELETE_LIMIT_NUM_FILES,
        HADOOP_SHELL_SAFELY_DELETE_LIMIT_NUM_FILES_DEFAULT);
    if (deleteLimit > 0) {
      ContentSummary cs = item.fs.getContentSummary(item.path);
      final long numFiles = cs.getFileCount();
      if (numFiles > deleteLimit) {
        if (!ToolRunner.confirmPrompt("Proceed deleting " + numFiles +
            " files?")) {
          System.err.println("Delete aborted at user request.\n");
          shouldDelete = false;
        }
      }
    }
  }
  return shouldDelete;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:22,代碼來源:Delete.java

示例2: isEmptyPath

import org.apache.hadoop.fs.ContentSummary; //導入方法依賴的package包/類
public static boolean isEmptyPath(JobConf job, Path dirPath, Context ctx)
    throws Exception {
  if (ctx != null) {
    ContentSummary cs = ctx.getCS(dirPath);
    if (cs != null) {
      LOG.info("Content Summary " + dirPath + "length: " + cs.getLength() + " num files: "
          + cs.getFileCount() + " num directories: " + cs.getDirectoryCount());
      return (cs.getLength() == 0 && cs.getFileCount() == 0 && cs.getDirectoryCount() <= 1);
    } else {
      LOG.info("Content Summary not cached for " + dirPath);
    }
  }
  return isEmptyPath(job, dirPath);
}
 
開發者ID:mini666,項目名稱:hive-phoenix-handler,代碼行數:15,代碼來源:Utilities.java

示例3: getTotalInputNumFiles

import org.apache.hadoop.fs.ContentSummary; //導入方法依賴的package包/類
/**
 * Computes the total number of input files. If block sampling was used it will scale this
 * value by the highest sample percentage (as an estimate for # input files).
 *
 * @param inputSummary
 * @param work
 * @param highestSamplePercentage
 * @return
 */
public static long getTotalInputNumFiles (ContentSummary inputSummary, MapWork work,
    double highestSamplePercentage) {
  long totalInputNumFiles = inputSummary.getFileCount();
  if (work.getNameToSplitSample() == null || work.getNameToSplitSample().isEmpty()) {
    // If percentage block sampling wasn't used, we don't need to do any estimation
    return totalInputNumFiles;
  }

  if (highestSamplePercentage >= 0) {
    totalInputNumFiles = Math.min((long) (totalInputNumFiles * (highestSamplePercentage / 100D))
        , totalInputNumFiles);
  }
  return totalInputNumFiles;
}
 
開發者ID:mini666,項目名稱:hive-phoenix-handler,代碼行數:24,代碼來源:Utilities.java


注:本文中的org.apache.hadoop.fs.ContentSummary.getFileCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。