@Override public Result getNextTuple() throws ExecException { res = super.getNextTuple(); if (writer == null) { // In the case of combiner return res; } try { switch (res.returnStatus) { case POStatus.STATUS_OK: if (illustrator == null) { Tuple result = (Tuple) res.result; Byte index = (Byte) result.get(0); PigNullableWritable key = HDataType.getWritableComparableTypes(result.get(1), keyType); NullableTuple val = new NullableTuple((Tuple) result.get(2)); // Both the key and the value need the index. The key needs it so // that it can be sorted on the index in addition to the key // value. The value needs it so that POPackage can properly // assign the tuple to its slot in the projection. key.setIndex(index); val.setIndex(index); if (isSkewedJoin) { // Wrap into a NullablePartitionWritable to match the key // of the right table from POPartitionRearrangeTez for the skewed join NullablePartitionWritable wrappedKey = new NullablePartitionWritable(key); wrappedKey.setPartition(-1); key = wrappedKey; } writer.write(key, val); } else { illustratorMarkup(res.result, res.result, 0); } res = RESULT_EMPTY; break; case POStatus.STATUS_EOP: case POStatus.STATUS_ERR: case POStatus.STATUS_NULL: default: break; } } catch (IOException ioe) { int errCode = 2135; String msg = "Received error from POLocalRearrage function." + ioe.getMessage(); throw new ExecException(msg, errCode, ioe); } return inp; }
@Override public void write(Object key, Object value) throws IOException, InterruptedException { out.write(key, value); }
public void collect(Object key, Object value) throws IOException { output.write(key, value); }