Usando questo MultipleScanTableInputFormat, è possibile utilizzare Configurazione MultipleScanTableInputFormat.PARTITIONS_PER_REGION_SERVER per controllare quanti mappatori devono essere eseguiti contro un singolo server delle regioni. La classe raggrupperà tutte le divisioni di input in base alla loro posizione (regionerver) e RecordReader eseguirà correttamente tutte le divisioni aggregate per il programma di mapping.
Ecco l'esempio
https://gist.github.com/bbeaudreault/9788499#file-multiplescantableinputformat-java-L90
che il lavoro che hai creato le molteplici scissioni aggregati per un singolo mapper
private List<InputSplit> getAggregatedSplits(JobContext context) throws IOException {
final List<InputSplit> aggregatedSplits = new ArrayList<InputSplit>();
final Scan scan = getScan();
for (int i = 0; i < startRows.size(); i++) {
scan.setStartRow(startRows.get(i));
scan.setStopRow(stopRows.get(i));
setScan(scan);
aggregatedSplits.addAll(super.getSplits(context));
}
// set the state back to where it was..
scan.setStopRow(null);
scan.setStartRow(null);
setScan(scan);
return aggregatedSplits;
}
Crea partizione server Regione
@Override
public List<InputSplit> getSplits(JobContext context) throws IOException {
List<InputSplit> source = getAggregatedSplits(context);
if (!partitionByRegionServer) {
return source;
}
// Partition by regionserver
Multimap<String, TableSplit> partitioned = ArrayListMultimap.<String, TableSplit>create();
for (InputSplit split : source) {
TableSplit cast = (TableSplit) split;
String rs = cast.getRegionLocation();
partitioned.put(rs, cast);
}