So far, we know that mapreduce has three path input methods.
1. The first method is to enter the following information:
Fileinputformat. addinputpath (job, new path (ARGs [0]);
Fileinputformat. addinputpath (job, new path (ARGs [1]);
Fileinputformat. addinputpath (job, new path (ARGs [2]);
Fileinputformat. addinputpath (job, new path (ARGs [3]);
This method can receive file input in multiple paths, but these files are processed by a map.
2. The second type is input in the following way (the second path parameter is pass, multiple paths are divided ):
Fileinputformat. addinputpaths (job, argS [0] + "," + ARGs [1] + "," + ARGs [2]);
This method is similar to the first method. You can see from the source code that this method splits the path into string [] paths arrays and then recycles the first method of calling, in addition, it uses a map for processing.
3. The third type is input in the following way:
Multipleinputs. addinputpath (job, new path (ARGs [0]), textinputformat. Class, mapper1.class );
Multipleinputs. addinputpath (job, new path (ARGs [1]), textinputformat. Class, mapper2.class );
Multipleinputs. addinputpath (job, new path (ARGs [2]), textinputformat. Class, mapper3.class );
This method is applicable to different input files. They may have different formats, and then write corresponding maps for their formats for processing. This method is more flexible.
From: http://f.dataguru.cn/thread-235219-1-1.html