/** {@inheritDoc} */ @Override public boolean nextKey() throws IOException, InterruptedException { if (cancelled) throw new HadoopTaskCancelledException("Task cancelled."); return input.next(); }
private void check(HadoopHashMultimap m, Multimap<Integer, Integer> mm, HadoopTaskContext taskCtx) throws Exception { final HadoopTaskInput in = m.input(taskCtx); Map<Integer, Collection<Integer>> mmm = mm.asMap(); int keys = 0; while (in.next()) { keys++; IntWritable k = (IntWritable)in.key(); assertNotNull(k); ArrayList<Integer> vs = new ArrayList<>(); Iterator<?> it = in.values(); while (it.hasNext()) vs.add(((IntWritable) it.next()).get()); Collection<Integer> exp = mmm.get(k.get()); assertEquals(sorted(exp), sorted(vs)); } X.println("keys: " + keys + " cap: " + m.capacity()); assertEquals(mmm.size(), keys); assertEquals(m.keys(), keys); in.close(); }
while (in.next()) { keys++;
while (in.next()) { keys++;
while (in.next()) { IntWritable key = (IntWritable)in.key();
while (in.next()) { IntWritable key = (IntWritable) in.key();
while (input.next()) { if (isCancelled()) throw new HadoopTaskCancelledException("Reduce task cancelled.");