如果一个文件块有130M,请问有多少个mapper

如果一个文件块有130M,请问有多少个mapper

  130M的文件将被分成2个mapper。

原因:根据FileInputFormat类 有一个成员变量

private static final double SPLIT_SLOP = 1.1

 也就是说如果文件大小在10%之内,程序并不会单独去开启一个mapper,而是会把这些多余的文件放在最后一个mapper。

public abstract class FileInputFormat<K, V> extends InputFormat<K, V> {

  private static final Log LOG = LogFactory.getLog(FileInputFormat.class);

  private static final double SPLIT_SLOP = 1.1;   // 10% slop

  private static final PathFilter hiddenFileFilter = new PathFilter(){
      public boolean accept(Path p){
原文地址:https://www.cnblogs.com/zhanggl/p/3860728.html