Hadoop 源码详解之FileInputFormat类

Hadoop 源码详解之FileInputFormat类【updating…】

1. 类释义

A base class for file-based InputFormats.
针对基于文件的 InputFormats 一个基类

FileInputFormat is the base class for all file-based InputFormats. This provides a generic implementation of getSplits(JobContext). Implementations of FileInputFormat can also override the isSplitable(JobContext, Path) method to prevent input files from being split-up in certain situations. Implementations that may deal with non-splittable files must override this method, since the default implementation assumes splitting is always possible.
FileInputFormat 是一个基类对于素有基于文件的InputFormats。这个类提供了一个一般的实现——getSplits(JobContext)FileInputFormat的实现也覆写了isSplitable(JobContext,Path)方法去阻止输入文件被文件在某些场景下被切割。 必须覆写这个方法才能同时实现不切割文件,因为默认的实现总是假设切割是可能的 。

2. 类源码
public abstract class FileOutputFormat<K, V> extends OutputFormat<K, V> {
...
}
3. 方法详解
3.1 setInputPaths()方法

Sets the given comma separated paths as the list of inputs for the map-reduce job.
使用给定的逗号分隔路径作为 为map-reduce job的文件列表

static void 	setInputPaths(Job job, Path... inputPaths)
Set the array of Paths as the list of inputs for the map-reduce job.

在这里插入图片描述注意,在调用这个方式时,可以看到有一个commaSeparate,这个表明的就是后面可跟逗号分隔的文件列表。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

说文科技

看书人不妨赏个酒钱?

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值