* @return a {@link JSONArray} with all phases and all results.
* @throws IOException
*/
public static JSONArray readAllResults(final MapReduceResponseSource response) throws IOException {
Map<Integer, JSONArray> phases = new LinkedHashMap<Integer, JSONArray>();
MapReduceResponse mrr;
JSONArray latest;
int phase = 0;
while (response.hasNext()) {
mrr = response.next();
try {
latest = mrr.getJSON();
if (latest != null) {
phase = mrr.getPhase();
JSONArray results;
if (phases.containsKey(phase)) {
results = phases.get(phase);
} else {
results = new JSONArray();