SLIDE 35 PageRank and recommenders on very large scale Stratosphere Input Contracts Match
Match
public static class ConcatPaths extends MatchStub implements Serializable { //define outputRecord, length, hopCnt, hopList... @Override public void match(PactRecord rec1, PactRecord rec2, Collector<PactRecord>
// rec1 has matching start, rec2 matching end final PactString fromNode = rec2.getField(0, PactString.class); final PactString toNode = rec1.getField(1, PactString.class); if (fromNode.equals(toNode)) return; //circle prevention // Create new path
- utputRecord.setField(0, fromNode);
- utputRecord.setField(1, toNode);
// Compute length of new path & hop count ... // Concatenate hops lists and insert matching node... // Append the whole path in a Stringbuilder... hopList.setValue(sb.toString().trim());
- utputRecord.setField(4, hopList);
- ut.collect(outputRecord);
} }