for (int value: constantSet.value()) { semanticProperties.addForwardedField(value,value);
@ConstantFields(0) public class RecomputeClusterCenter extends ReduceFunction implements Serializable { private static final long serialVersionUID = 1L;
@ConstantFields(1) public class FindNearestCenter extends ReduceFunction implements Serializable { private static final long serialVersionUID = 1L;
@ConstantFields(0) public static class BuildTriads extends ReduceFunction implements Serializable { private static final long serialVersionUID = 1L;
@ConstantFields({0,1}) public static class FilterO extends MapFunction implements Serializable { private static final long serialVersionUID = 1L;
@ConstantFields({0,1}) public static class AggLiO extends ReduceFunction implements Serializable { private static final long serialVersionUID = 1L;
@Combinable @ConstantFields(0) public static class CountWords extends ReduceFunction implements Serializable {
@ConstantFields(1) public static class AggCO extends ReduceFunction implements Serializable { private static final long serialVersionUID = 1L;
@ConstantFields(0) public static final class MinimumComponentIDReduce extends ReduceFunction implements Serializable { private static final long serialVersionUID = 1L;
/** * Sums up the counts for a certain given key. The counts are assumed to be at position <code>1</code> * in the record. The other fields are not modified. */ @Combinable @ConstantFields(0) public static class CountWords extends ReduceFunction implements Serializable { private static final long serialVersionUID = 1L; @Override public void reduce(Iterator<Record> records, Collector<Record> out) throws Exception { Record element = null; int sum = 0; while (records.hasNext()) { element = records.next(); int cnt = element.getField(1, IntValue.class).getValue(); sum += cnt; } element.setField(1, new IntValue(sum)); out.collect(element); } @Override public void combine(Iterator<Record> records, Collector<Record> out) throws Exception { // the logic is the same as in the reduce function, so simply call the reduce method reduce(records, out); } }
/** * Sums up the counts for a certain given key. The counts are assumed to be at position <code>1</code> * in the record. The other fields are not modified. */ @Combinable @ConstantFields(0) public static class CountWords extends ReduceFunction { private static final long serialVersionUID = 1L; @Override public void reduce(Iterator<Record> records, Collector<Record> out) throws Exception { Record element = null; int sum = 0; while (records.hasNext()) { element = records.next(); int cnt = element.getField(1, IntValue.class).getValue(); sum += cnt; } element.setField(1, new IntValue(sum)); out.collect(element); } @Override public void combine(Iterator<Record> records, Collector<Record> out) throws Exception { // the logic is the same as in the reduce function, so simply call the reduce method reduce(records, out); } }
/** * Sums up the counts for a certain given key. The counts are assumed to be at position <code>1</code> * in the record. The other fields are not modified. */ @Combinable @ConstantFields(0) public static class CountWords extends ReduceFunction implements Serializable { private static final long serialVersionUID = 1L; @Override public void reduce(Iterator<Record> records, Collector<Record> out) throws Exception { Record element = null; int sum = 0; while (records.hasNext()) { element = records.next(); int cnt = element.getField(1, IntValue.class).getValue(); sum += cnt; } element.setField(1, new IntValue(sum)); out.collect(element); } @Override public void combine(Iterator<Record> records, Collector<Record> out) throws Exception { // the logic is the same as in the reduce function, so simply call the reduce method reduce(records, out); } }
@Combinable @ConstantFields(0) public static final class UpdateRankReduceDelta extends ReduceFunction { private static final long serialVersionUID = 1L; private final DoubleValue newRank = new DoubleValue(); @Override public void reduce(Iterator<Record> records, Collector<Record> out) { double rankSum = 0.0; double rank; Record rec = null; while (records.hasNext()) { rec = records.next(); rank = rec.getField(1, DoubleValue.class).getValue(); rankSum += rank; } // ignore small deltas if (Math.abs(rankSum) > 0.00001) { newRank.setValue(rankSum); rec.setField(1, newRank); out.collect(rec); } } }
@Combinable @ConstantFields(0) public static final class AggregatingReduce extends ReduceFunction implements Serializable { private static final long serialVersionUID = 1L; private final DoubleValue sum = new DoubleValue(); @Override public void reduce(Iterator<Record> pageWithPartialRank, Collector<Record> out) throws Exception { Record rec = null; double rankSum = 0.0; while (pageWithPartialRank.hasNext()) { rec = pageWithPartialRank.next(); rankSum += rec.getField(1, DoubleValue.class).getValue(); } sum.setValue(rankSum); rec.setField(1, sum); out.collect(rec); } }
@Combinable @ConstantFields(0) public static class CountWords extends ReduceFunction implements Serializable { private static final long serialVersionUID = 1L; private final IntValue cnt = new IntValue(); @Override public void reduce(Iterator<Record> records, Collector<Record> out) { Record element = null; int sum = 0; while (records.hasNext()) { element = records.next(); IntValue i = element.getField(1, IntValue.class); sum += i.getValue(); } this.cnt.setValue(sum); element.setField(1, this.cnt); out.collect(element); } }
@Override protected int[] getOtherFields(FunctionAnnotation.ConstantFields other) { return other.value(); } }
@Override protected int[] getOtherFields(FunctionAnnotation.ConstantFields other) { return other.value(); } }