int tableIndex = 0, fileNumber = 0;
Integer[] fileNumbers = helper.getFileNumbers();
if (fileNumbers.length != realReaders.size())
throw new IOException("Number of tables in input paths of input splits is incorrect.");
for (int j=0; j<inputSplits.length; j++) {
FileSplit fileSplit = (FileSplit) inputSplits[j];
start = fileSplit.getStart();
if (start <= prevStart)
{
fileNumber++;
if (fileNumber >= fileNumbers[tableIndex])
{
inputSplitBoundaries[tableIndex++] = j;
fileNumber = 0;
}
}
prevStart = start;
}
inputSplitBoundaries[tableIndex++] = inputSplits.length;
if (tableIndex != realReaders.size())
throw new IOException("Number of tables in input splits is incorrect.");
for (tableIndex = 0; tableIndex < realReaders.size(); tableIndex++)
{
int startSplitIndex = (tableIndex == 0 ? 0 : inputSplitBoundaries[tableIndex - 1]);
int splitLen = (tableIndex == 0 ? inputSplitBoundaries[0] :
inputSplitBoundaries[tableIndex] - inputSplitBoundaries[tableIndex-1]);
BasicTable.Reader reader = realReaders.get(tableIndex);
/* Get the index of the column group that will be used for row-split.*/
int splitCGIndex = reader.getRowSplitCGIndex();
long starts[] = new long[splitLen];
long lengths[] = new long[splitLen];
int batches[] = new int[splitLen + 1];
batches[0] = 0;
int numBatches = 0;
int batchSize = 0;
Path paths[] = new Path [splitLen];
long totalLen = 0;
final double SPLIT_SLOP = 1.1;
int endSplitIndex = startSplitIndex + splitLen;
for (int j=startSplitIndex; j< endSplitIndex; j++) {
FileSplit fileSplit = (FileSplit) inputSplits[j];
Path p = fileSplit.getPath();
long blockSize = p.getFileSystem(conf).getBlockSize(p);
long splitSize = (long) (helper.computeSplitSize(goalSize, minSize, blockSize) * SPLIT_SLOP);
start = fileSplit.getStart();
long length = fileSplit.getLength();
int index = j - startSplitIndex;
starts[index] = start;
lengths[index] = length;
totalLen += length;
paths[index] = p;