in datafu-pig/src/main/java/datafu/pig/bags/UnorderedPairs.java [58:95]
public DataBag exec(Tuple input) throws IOException
{
PigStatusReporter reporter = PigStatusReporter.getInstance();
try {
DataBag inputBag = (DataBag) input.get(0);
DataBag outputBag = bagFactory.newDefaultBag();
long i=0, j, cnt=0;
if (inputBag != null)
{
for (Tuple elem1 : inputBag) {
j = 0;
for (Tuple elem2 : inputBag) {
if (j > i) {
outputBag.add(tupleFactory.newTuple(Arrays.asList(elem1, elem2)));
cnt++;
}
j++;
if (reporter != null)
reporter.progress();
if (cnt % 1000000 == 0) {
outputBag.spill();
cnt = 0;
}
}
i++;
}
}
return outputBag;
}
catch (Exception e) {
throw new RuntimeException("Caught exception processing input of " + this.getClass().getName(), e);
}
}