if (shuffleInput) {
while (shuffleReader.next()) {
Object curKey = shuffleReader.getCurrentKey();
Iterable<Object> vals = shuffleReader.getCurrentValues();
if (isSkewedJoin) {
NullablePartitionWritable wrappedKey = new NullablePartitionWritable(
(PigNullableWritable) curKey);
wrappedKey.setPartition(-1);
curKey = wrappedKey;
}
for (Object val : vals) {
writer.write(curKey, val);
}
}
} else {
while (reader.next()) {
if (isSkewedJoin) {
NullablePartitionWritable wrappedKey = new NullablePartitionWritable(
(PigNullableWritable) reader.getCurrentKey());
// Skewed join wraps key with NullablePartitionWritable
// The partitionIndex in NullablePartitionWritable is not serialized.
// So setting it here instead of the previous vertex POLocalRearrangeTez.
// Serializing it would add overhead for MR as well.
wrappedKey.setPartition(-1);
writer.write(wrappedKey, reader.getCurrentValue());
} else {
writer.write(reader.getCurrentKey(),
reader.getCurrentValue());
}