@Override public void open(Configuration parameters) throws Exception { if (getRuntimeContext().hasBroadcastVariable("number of vertices")) { Collection<LongValue> numberOfVertices = getRuntimeContext().getBroadcastVariable("number of vertices"); this.sumFunction.setNumberOfVertices(numberOfVertices.iterator().next().getValue()); } if (getIterationRuntimeContext().getSuperstepNumber() == 1) { this.sumFunction.init(getIterationRuntimeContext()); } this.sumFunction.preSuperstep(); }
@Override public void close() throws Exception { this.sumFunction.postSuperstep(); }
@Override public Tuple2<K, M> reduce(Tuple2<K, M> arg0, Tuple2<K, M> arg1) throws Exception { M result = this.sumFunction.sum(arg0.f1, arg1.f1); // if the user returns value from the right argument then swap as // in ReduceDriver.run() if (result == arg1.f1) { M tmp = arg1.f1; arg1.f1 = arg0.f1; arg0.f1 = tmp; } else { arg0.f1 = result; } return arg0; }
@Override public void open(Configuration parameters) throws Exception { if (getRuntimeContext().hasBroadcastVariable("number of vertices")) { Collection<LongValue> numberOfVertices = getRuntimeContext().getBroadcastVariable("number of vertices"); this.sumFunction.setNumberOfVertices(numberOfVertices.iterator().next().getValue()); } if (getIterationRuntimeContext().getSuperstepNumber() == 1) { this.sumFunction.init(getIterationRuntimeContext()); } this.sumFunction.preSuperstep(); }
@Override public void close() throws Exception { this.sumFunction.postSuperstep(); }
@Override public Tuple2<K, M> reduce(Tuple2<K, M> arg0, Tuple2<K, M> arg1) throws Exception { M result = this.sumFunction.sum(arg0.f1, arg1.f1); // if the user returns value from the right argument then swap as // in ReduceDriver.run() if (result == arg1.f1) { M tmp = arg1.f1; arg1.f1 = arg0.f1; arg0.f1 = tmp; } else { arg0.f1 = result; } return arg0; }
@Override public void open(Configuration parameters) throws Exception { if (getRuntimeContext().hasBroadcastVariable("number of vertices")) { Collection<LongValue> numberOfVertices = getRuntimeContext().getBroadcastVariable("number of vertices"); this.sumFunction.setNumberOfVertices(numberOfVertices.iterator().next().getValue()); } if (getIterationRuntimeContext().getSuperstepNumber() == 1) { this.sumFunction.init(getIterationRuntimeContext()); } this.sumFunction.preSuperstep(); }
@Override public void close() throws Exception { this.sumFunction.postSuperstep(); }
@Override public Tuple2<K, M> reduce(Tuple2<K, M> arg0, Tuple2<K, M> arg1) throws Exception { M result = this.sumFunction.sum(arg0.f1, arg1.f1); // if the user returns value from the right argument then swap as // in ReduceDriver.run() if (result == arg1.f1) { M tmp = arg1.f1; arg1.f1 = arg0.f1; arg0.f1 = tmp; } else { arg0.f1 = result; } return arg0; }
@Override public void open(Configuration parameters) throws Exception { if (getRuntimeContext().hasBroadcastVariable("number of vertices")) { Collection<LongValue> numberOfVertices = getRuntimeContext().getBroadcastVariable("number of vertices"); this.sumFunction.setNumberOfVertices(numberOfVertices.iterator().next().getValue()); } if (getIterationRuntimeContext().getSuperstepNumber() == 1) { this.sumFunction.init(getIterationRuntimeContext()); } this.sumFunction.preSuperstep(); }
@Override public void close() throws Exception { this.sumFunction.postSuperstep(); }
@Override public Tuple2<K, M> reduce(Tuple2<K, M> arg0, Tuple2<K, M> arg1) throws Exception { M result = this.sumFunction.sum(arg0.f1, arg1.f1); // if the user returns value from the right argument then swap as // in ReduceDriver.run() if (result == arg1.f1) { M tmp = arg1.f1; arg1.f1 = arg0.f1; arg0.f1 = tmp; } else { arg0.f1 = result; } return arg0; }