//mro.toMap.list.get(index).add(lo.spec);
mro.mapParallelism = Math.max(mro.mapParallelism, lo.getRequestedParallelism());
} else { // push into "reduce" phase
EvalSpec spec = lo.getSpec();
if (mro.toReduce == null && shouldCombine(spec, mro)) {
// Push this spec into the combiner. But we also need to
// create a new spec with a changed expected projection to
// push into the reducer.
if (mro.toCombine != null) {
throw new AssertionError("Combiner already set.");
}
// mro.toCombine = spec;
// Now, we need to adjust the expected projection for the
// eval spec(s) we just pushed. Also, this will change the
// function to be the final instead of general instance.
EvalSpec newSpec = spec.copy(pigContext);
newSpec.visit(new ReduceAdjuster(pigContext));
mro.addReduceSpec(newSpec);
// Adjust the function name for the combine spec, to set it
// to the initial function instead of the general
// instance. Make a copy of the eval spec rather than
// adjusting the existing one, to prevent breaking the
// logical plan in case another physical plan is generated
// from it later.
EvalSpec combineSpec = spec.copy(pigContext);
combineSpec.visit(new CombineAdjuster());
mro.toCombine = combineSpec;
} else {
mro.addReduceSpec(lo.getSpec()); // otherwise, don't use combiner
}