Hadoop的InputFormat和OutputFormat
来源:互联网 发布:企业域名实名认证 编辑:程序博客网 时间:2024/05/19 17:57
一 InputFormat概述:
(1)InputFormat类:InputFormat用来描述和控制MapReduce Job的数据输入。
(2)InputSplit(输入分片):代表分配给单个map任务的数据。InputSplit存储的并非数据本身,而是一个分片长度和一个记录数据位置的数组,生成InputSplit的方法可通过InputFormat来设置。InputFormat的getSplits方法可以生成InputSplit相关信息,包括两部分:InputSplit元数据信息和原始InputSplit信息。InputSplit元数据信息将被JobTracker使用,用以生成Task本地性相关数据结构;原始InputSplit信息将被Map Task初始化时使用,用以获取自己要处理的数据。
(3)map任务处理的数据是由InputFormat分解过的数据,InputFormat将数据集分割为输入分片(InputSplit)。map会将分片传送给InputFormat,InputFormat调用getRecordReader方法生成RecordReader,RecordReader再通过createKey、createValue方法创建可供Map处理的<key,value>。
(4)Hadoop预定义了多种方法将不同类型输入数据转化为Map能处理的<key,value>对(也可自定义),它们都继承自InputFormat,分别是:
*DBInputFormat
*DelegatingInputFormat
*FIleInputFormat:CombineFileInputFormat, KeyValueTextInputFormat, NLineInputFormat,SequenceFileInputFormat, TextInputFormat。
二 OutputFormat概述:
(1)OutputFormat类:OutputFormat类描述和控制MapReduce Job的数据输出。
(2)MapReduce框架需要OutputFormat做的工作:
*Validate the output-specification of the job. For e.g. check that the output directory doesn't already exist.
*Provide the RecordWriter implementation to be used to write out the output files of the job. Output files are stored in a FileSystem.
- Hadoop的InputFormat和OutputFormat
- Hadoop:InputFormat和OutputFormat
- Hadoop开发常用的InputFormat和OutputFormat
- Hadoop开发常用的InputFormat和OutputFormat
- Hadoop开发常用的InputFormat和OutputFormat
- Hadoop开发常用的InputFormat和OutputFormat
- Hadoop开发常用的InputFormat和OutputFormat
- Hadoop开发常用的InputFormat和OutputFormat
- Hadoop开发常用的InputFormat和OutputFormat
- Hadoop开发常用的InputFormat和OutputFormat
- hadoop 自定义inputformat和outputformat
- Hadoop自定义 inputformat 和outputformat 实现图像的读写
- Hadoop中常用的InputFormat,OutPutFormat类
- Hadoop中常用的InputFormat、OutputFormat
- OutputFormat和InputFormat
- 在Hadoop的streaming中使用自定义的inputformat和outputformat
- 在Hadoop的streaming中使用自定义的inputformat和outputformat
- Hadoop中常用的InputFormat、OutputFormat(转)
- [codility]Equi-leader
- 一个很好用excel导出类
- 单例模式
- How to secure an Ubuntu 12.04 LTS server - Part 1 The Basics
- 字符串反转
- Hadoop的InputFormat和OutputFormat
- 算法杂谈--关于二叉树
- 音频视频解决方案:GStreamer/ffmpeg/ffdshow/directshow/vfw
- 再牛的梦想,也抵挡不住傻瓜似的坚持
- 如何截取字符串里面的所有数字
- CImage类的介绍与使用
- powersave/performance governor study
- ubuntu终端字体设置
- sturt2提交表单时Error setting expression 'XXX' with value '[Ljava.lang.String;@1dad8