private static InputSplit[] getUnsortedSplits(JobConf conf, int numSplits,
TableExpr expr, List<BasicTable.Reader> readers,
List<BasicTableStatus> status) throws IOException {
long totalBytes = 0;
for (Iterator<BasicTableStatus> it = status.iterator(); it.hasNext();) {
BasicTableStatus s = it.next();
totalBytes += s.getSize();
}
long maxSplits = totalBytes / getMinSplitSize(conf);
if (numSplits > maxSplits) {
numSplits = -1;
}
ArrayList<InputSplit> ret = new ArrayList<InputSplit>();;
if (numSplits <= 0) {
for (int i = 0; i < readers.size(); ++i) {
BasicTable.Reader reader = readers.get(i);
List<RangeSplit> subSplits = reader.rangeSplit(-1);
for (Iterator<RangeSplit> it = subSplits.iterator(); it.hasNext();) {
UnsortedTableSplit split =
new UnsortedTableSplit(reader, it.next(), conf);
ret.add(split);
}
}
} else {
long goalSize = totalBytes / numSplits;
double SPLIT_SLOP = 1.1;
for (int i = 0; i < readers.size(); ++i) {
BasicTable.Reader reader = readers.get(i);
BasicTableStatus s = status.get(i);
int nSplits =
(int) ((s.getSize() + goalSize * (2 - SPLIT_SLOP)) / goalSize);
if (nSplits > 1) {
List<RangeSplit> subSplits = reader.rangeSplit(nSplits);
for (Iterator<RangeSplit> it = subSplits.iterator(); it.hasNext();) {
UnsortedTableSplit split =
new UnsortedTableSplit(reader, it.next(), conf);