这段代码理解:
-
List<InputSplit>splits=newArrayList<InputSplit>();
-
for(FileStatusfile:listStatus(job)){
-
Pathpath=file.getPath();
-
FileSystemfs=path.getFileSystem(job.getConfiguration());
-
longlength=file.getLen();
-
BlockLocation[]blkLocations=fs.getFileBlockLocations(file,0,length);
-
if((length!=0)&&isSplitable(job,path)){
-
longblockSize=file.getBlockSize();
-
longsplitSize=computeSplitSize(blockSize,minSize,maxSize);
-
-
longbytesRemaining=length;
-
while(((double)bytesRemaining)/splitSize>SPLIT_SLOP){
-
intblkIndex=getBlockIndex(blkLocations,length-bytesRemaining);
-
splits.add(newFileSplit(path,length-bytesRemaining,splitSize,
-
blkLocations[blkIndex].getHosts()));
-
bytesRemaining-=splitSize;
-
}
-
-
if(bytesRemaining!=0){
-
splits.add(newFileSplit(path,length-bytesRemaining,bytesRemaining,
-
blkLocations[blkLocations.length-1].getHosts()));
-
}
-
}elseif(length!=0){
-
splits.add(newFileSplit(path,0,length,blkLocations[0].getHosts()));
-
}else{
-
-
splits.add(newFileSplit(path,0,length,newString[0]));
-
}
-
}
-
LOG.debug("Total#ofsplits:"+splits.size());
-
returnsplits;
-
}
需要split跨block的话,调整下splitSize就行了,比如可以将splitSize设为blockSize的1.5倍就行了。
这里代码的理解:
就是在剩余的字节数大于SPLIT_SLOP时不断生成新split, 剩余字节不超过1.1个split时作为一个split处理,这样能够利用split的跨块读取,且节省资源。
由于我其他的处理逻辑需要分的很清, 不能1.1(SPLIT_SLOP默认1.1),
即使剩余不到10%,也要作为一个新块处理, 因此改为1.0我的问题就解决了!
split的作用主要有两个:1是作为逻辑单元,便于分布式处理,不像block只能在单个节点上,而是对于不完整的记录能够跨块读取,方便很多。
分享到:
相关推荐
1. block是物理上的数据分割,而split是逻辑上的分割 3. 用户可以在M/R 程序中自定义split size 4. 一个split 可以包含多个bl
1. block是物理上的数据分割,而split是逻辑上的分割 3. 用户可以在M/R 程序中自定义split size 4. 一个split 可以包含多个bl
分块 将句子分成不同类型的块。 注意 所有 strs 都表示为 python 数据结构“str”,因为我们在这里只处理英语。 执照 麻省理工学院。 陈大卫@17zuoye
motion estimation algorithms based on merge and split procedures for H.264/MPEG-4 AVC video encoding. The algorithms take advantage of the correlation of the Motion Vectors (MVs) of the different ...
adjacent rows for information block .The split gate cell design and thick oxide tunneling injector attain better reliability and manufacturability compared with alternative approaches. The SFD64KX32...
A page is composed of 4 adjacent rows for main memory block and 4 adjacent rows for information block .The split gate cell design and thick oxide tunneling injector attain better reliability and ...
作者: William Miller. 抓取屏幕的免费软件,带全部源程序;支持抓取整屏、选择区、选择窗口或对象等,是DELPHI3编译得很老的程序,用来研究研究还是不错的。发布者:cjsh(wjh_wy@163.com) QQ:39306255
block=[] #lines函数返回的yield存储值,拿来每⾏遍历,根据是否有空⾏找出段落 for line in lines(file): #判断是否为字符串,字符串才有split()⽅法,如果有,追加到block⾥,开始回到lines中进⼊到下⼀次循环, ...
QString toId = QString(windowTitle.split("[").at(1)); QString msgType = "MSG_CLIENT_CHAT"; QByteArray block; QDataStream out(&block, QIODevice::WriteOnly); out.setVersion(QDataStream::Qt_4_6); ...
Solution – Quota Arrangement We also need to diversify our source of supplies to mitigate the impact of ...How to split a block of purchase quantity and distribute them among multiple suppliers??
Cran split### This code block is evaluatd when the buffer is run in IDLE. It would### not be run if this module were used elsewhere
拆分背景与文本叠加这是一个类似于核心标题块的WordPress Gutenberg块,但允许管理员在背景的左侧和右侧进行选择以及图像或颜色。
Mapreduce 的 input split 就是一个 block。( ) 31. NameNode 的 Web UI 端口是 50030,它通过 jetty 启动的 Web 服务。( ) 32. Hadoop 环境变量中的 HADOOP_HEAPSIZE 用于设置所有 Hadoop 守护线程的内存。它默认...
Mapreduce 的 input split 就是一个 block。( ) 31. NameNode 的 Web UI 端口是 50030,它通过 jetty 启动的 Web 服务。( ) 32. Hadoop 环境变量中的 HADOOP_HEAPSIZE 用于设置所有 Hadoop 守护线程的内存。它默认...
单项选择题 1. 下面哪个程序负责 HDFS 数据存储。... Mapreduce 的 input split 就是一个 block。( ) 31. NameNode 的 Web UI 端口是 50030,它通过 jetty 启动的 Web 服务。( ) 32. Hadoop 环境变
单项选择题 1. 下面哪个程序负责 HDFS 数据存储。 a)NameNode b)Jobtracker c)... Mapreduce 的 input split 就是一个 block。( ) 31. NameNode 的 Web UI 端口是 50030,它通过 jetty 启动的 Web 服务。( ) 32. Ha
单项选择题 1. 下面哪个程序负责 HDFS 数据存储。 a)NameNode b)Jobtracker c)Datanode d)... Mapreduce 的 input split 就是一个 block。( ) 31. NameNode 的 Web UI 端口是 50030,它通过 jetty 启动的 W
一次性电子邮件域列表 ... 我们不能保证所有这些都仍然可以被视为一次性使用,但我们会进行基本检查,以确保... split ( '@' )[ 1 ] in blocklist_content : message = "Please enter your permanent email address." r
String[] str = line.split(","); List<String> list = map.get(str[1]); if(list == null){ list = new ArrayList(); } list.add(str[0]); map.put(str[1], list); }...
// This function renders a block of buttons function renderButtons(title){ Ext.getBody().createChild({tag: 'h2', html: title}); new ButtonPanel( 'Text Only', [{ text: 'Add User' },{ text: '...