1
我剛開始學習Hadoop,並且有各種格式的輸入類型。我有幾個程序要研究,我的主要問題是如何確定輸入格式是TextInputFormat還是KeyValueTextInputFormat或其他。 你的幫助是非常讚賞如何識別MapReduce程序中的輸入格式
我剛開始學習Hadoop,並且有各種格式的輸入類型。我有幾個程序要研究,我的主要問題是如何確定輸入格式是TextInputFormat還是KeyValueTextInputFormat或其他。 你的幫助是非常讚賞如何識別MapReduce程序中的輸入格式
您不必識別InputFormat
正在使用MapReduce的程序。
InputFormat
是你可以明確地在程序中指定的東西,MapReduce作業將使用它。
如果您不指定任何內容,它將使用默認值,它將擴展FileInputFormat<LongWritable, Key>
。這就是爲什麼在一個簡單的單詞計數程序,你會經常看到Mapper
類定義爲:
public class MyMapper extends Mapper<LongWritable, Key, Text, IntWritable> {
//...
}
您可以指定InputFormat在JobConf
對象使用:
JobConf job = new JobConf(new Configuration(), MyJob.class);
job.setInputFormat(SequenceFileInputFormat.class);
job.setOutputFormat(SequenceFileOutputFormat.class);
鏈接:InputFormat.class進一步讀。