@Override public IterOutcome innerNext() { try { IterOutcome upstream = unionAllInput.nextBatch(); logger.debug("Upstream of Union-All: {}", upstream); switch (upstream) { case NONE: case OUT_OF_MEMORY: case STOP: return upstream; case OK_NEW_SCHEMA: outputFields = unionAllInput.getOutputFields(); case OK: IterOutcome workOutcome = doWork(); if (workOutcome != IterOutcome.OK) { return workOutcome; } else { return upstream; } default: throw new IllegalStateException(String.format("Unknown state %s.", upstream)); } } catch (ClassTransformationException | IOException | SchemaChangeException ex) { context.fail(ex); killIncoming(false); return IterOutcome.STOP; } }
@Override protected void killIncoming(boolean sendUpstream) { unionAllInput.getLeftRecordBatch().kill(sendUpstream); unionAllInput.getRightRecordBatch().kill(sendUpstream); }