@ForwardedFieldsFirst("f0") @ForwardedFieldsSecond("f1") private static final class ProjectNeighborValue<K, VV, EV> implements FlatJoinFunction< Tuple3<K, K, Edge<K, EV>>, Vertex<K, VV>, Tuple2<K, VV>> { public void join(Tuple3<K, K, Edge<K, EV>> keysWithEdge, Vertex<K, VV> neighbor, Collector<Tuple2<K, VV>> out) { out.collect(new Tuple2<>(keysWithEdge.f0, neighbor.getValue())); } }
@FunctionAnnotation.ForwardedFields("0->4;1;1->3;2") @FunctionAnnotation.ReadFields("0;3;4") private static class DummyReduceFunction1 implements ReduceFunction<Tuple5<Integer, Long, String, Long, Integer>> { @Override public Tuple5<Integer, Long, String, Long, Integer> reduce(Tuple5<Integer, Long, String, Long, Integer> v1, Tuple5<Integer, Long, String, Long, Integer> v2) throws Exception { return new Tuple5<Integer, Long, String, Long, Integer>(); } }
@FunctionAnnotation.NonForwardedFieldsFirst("0;2") @FunctionAnnotation.NonForwardedFieldsSecond("0;1") private static class AllForwardedExceptJoin<X> implements JoinFunction<Tuple3<X, X, X>, Tuple3<X, X, X>, Tuple3<X, X, X>> { @Override public Tuple3<X, X, X> join(Tuple3<X, X, X> first, Tuple3<X, X, X> second) throws Exception { return null; } }
@FunctionAnnotation.ForwardedFieldsFirst("0->4;1;1->3") @FunctionAnnotation.ForwardedFieldsSecond("2;4->0") @FunctionAnnotation.ReadFieldsFirst("0;2;4") @FunctionAnnotation.ReadFieldsSecond("1;3") private static class DummyTestCoGroupFunction1 implements CoGroupFunction<Tuple5<Integer, Long, String, Long, Integer>, Tuple5<Integer, Long, String, Long, Integer>, Tuple5<Integer, Long, String, Long, Integer>> { @Override public void coGroup(Iterable<Tuple5<Integer, Long, String, Long, Integer>> first, Iterable<Tuple5<Integer, Long, String, Long, Integer>> second, Collector<Tuple5<Integer, Long, String, Long, Integer>> out) throws Exception { } }
@ForwardedFields("*->f0;*->f1") private static final class DuplicateValue<T> implements MapFunction<T, Tuple2<T, T>> { @Override public Tuple2<T, T> map(T vertex) { return new Tuple2<T, T>(vertex, vertex); } }
@FunctionAnnotation.ReadFieldsFirst("1") @FunctionAnnotation.ReadFieldsSecond("0") private static class ReadSetJoin<X> implements JoinFunction<Tuple2<X, X>, Tuple2<X, X>, Tuple3<X, X, X>> { @Override public Tuple3<X, X, X> join(Tuple2<X, X> first, Tuple2<X, X> second) throws Exception { return null; } } }
@ForwardedFieldsFirst("f0; f2->f1") @ForwardedFieldsSecond("*->f2") private static final class ProjectEdgeWithNeighbor<K, VV, EV> implements FlatJoinFunction< Tuple3<K, K, Edge<K, EV>>, Vertex<K, VV>, Tuple3<K, Edge<K, EV>, Vertex<K, VV>>> { public void join(Tuple3<K, K, Edge<K, EV>> keysWithEdge, Vertex<K, VV> neighbor, Collector<Tuple3<K, Edge<K, EV>, Vertex<K, VV>>> out) { out.collect(new Tuple3<>(keysWithEdge.f0, keysWithEdge.f2, neighbor)); } }
@FunctionAnnotation.ForwardedFieldsFirst("0->4;1;1->3") @FunctionAnnotation.ForwardedFieldsSecond("2;4->0") @FunctionAnnotation.ReadFieldsFirst("0;2;4") @FunctionAnnotation.ReadFieldsSecond("1;3") private static class DummyTestJoinFunction1 implements JoinFunction<Tuple5<Integer, Long, String, Long, Integer>, Tuple5<Integer, Long, String, Long, Integer>, Tuple5<Integer, Long, String, Long, Integer>> { @Override public Tuple5<Integer, Long, String, Long, Integer> join( Tuple5<Integer, Long, String, Long, Integer> first, Tuple5<Integer, Long, String, Long, Integer> second) throws Exception { return new Tuple5<Integer, Long, String, Long, Integer>(); } }
@FunctionAnnotation.ForwardedFields("0->4;1;1->3;2") @FunctionAnnotation.ReadFields("0;3;4") private static class DummyGroupReduceFunction1 implements GroupReduceFunction<Tuple5<Integer, Long, String, Long, Integer>, Tuple5<Integer, Long, String, Long, Integer>> { @Override public void reduce(Iterable<Tuple5<Integer, Long, String, Long, Integer>> values, Collector<Tuple5<Integer, Long, String, Long, Integer>> out) throws Exception { } }
@ForwardedFields("f0->f0;f0->f1") private static class Map2 implements MapFunction<Tuple2<String, Integer>, Tuple2<String, String>> { public Tuple2<String, String> map(Tuple2<String, Integer> value) throws Exception { return new Tuple2<String, String>(value.f0, value.f0); } }
@ForwardedFieldsFirst("f1->f2") @ForwardedFieldsSecond("f0; f1; f2->f3") private static final class ProjectEdgeWithSrcValue<K, VV, EV> implements FlatJoinFunction<Vertex<K, VV>, Edge<K, EV>, Tuple4<K, K, VV, EV>> { @Override public void join(Vertex<K, VV> vertex, Edge<K, EV> edge, Collector<Tuple4<K, K, VV, EV>> collector) throws Exception { collector.collect(new Tuple4<>(edge.getSource(), edge.getTarget(), vertex.getValue(), edge.getValue())); } }
@FunctionAnnotation.ForwardedFields("0->4;1;1->3;2") @FunctionAnnotation.ReadFields("0;3;4") private static class DummyGroupCombineFunction1 implements GroupCombineFunction<Tuple5<Integer, Long, String, Long, Integer>, Tuple5<Integer, Long, String, Long, Integer>> { @Override public void combine(Iterable<Tuple5<Integer, Long, String, Long, Integer>> values, Collector<Tuple5<Integer, Long, String, Long, Integer>> out) throws Exception { } }
@ForwardedFields("f0;f1") private static class Map20 implements MapFunction<Tuple4<Integer, Integer, Integer, Integer>, Tuple4<Integer, Integer, Integer, Integer>> { @Override public Tuple4<Integer, Integer, Integer, Integer> map(Tuple4<Integer, Integer, Integer, Integer> value) throws Exception { Tuple4<Integer, Integer, Integer, Integer> t = new Tuple4<Integer, Integer, Integer, Integer>(); t.f0 = value.getField(0); t.f1 = value.getField((int) 1L); return t; } }
@ForwardedFieldsFirst("f0; f1; f2; f3->f4") @ForwardedFieldsSecond("f1->f3") private static final class ProjectEdgeWithVertexValues<K, VV, EV> implements FlatJoinFunction<Tuple4<K, K, VV, EV>, Vertex<K, VV>, Triplet<K, VV, EV>> { @Override public void join(Tuple4<K, K, VV, EV> tripletWithSrcValSet, Vertex<K, VV> vertex, Collector<Triplet<K, VV, EV>> collector) throws Exception { collector.collect(new Triplet<>(tripletWithSrcValSet.f0, tripletWithSrcValSet.f1, tripletWithSrcValSet.f2, vertex.getValue(), tripletWithSrcValSet.f3)); } }
/** * UDF that joins a (Vertex-ID, Component-ID) pair that represents the current component that * a vertex is associated with, with a (Source-Vertex-ID, Target-VertexID) edge. The function * produces a (Target-vertex-ID, Component-ID) pair. */ @ForwardedFieldsFirst("f1->f1") @ForwardedFieldsSecond("f1->f0") public static final class NeighborWithComponentIDJoin implements JoinFunction<Tuple2<Long, Long>, Tuple2<Long, Long>, Tuple2<Long, Long>> { @Override public Tuple2<Long, Long> join(Tuple2<Long, Long> vertexWithComponent, Tuple2<Long, Long> edge) { return new Tuple2<Long, Long>(edge.f1, vertexWithComponent.f1); } }
@SuppressWarnings("serial") @ForwardedFieldsFirst("*->f0") @ForwardedFieldsSecond("f1->f1") private static final class AppendVertexState<K, VV, Message> implements JoinFunction<Vertex<K, VV>, Tuple2<K, Either<NullValue, Message>>, Tuple2<Vertex<K, VV>, Either<NullValue, Message>>> { private Tuple2<Vertex<K, VV>, Either<NullValue, Message>> outTuple = new Tuple2<>(); public Tuple2<Vertex<K, VV>, Either<NullValue, Message>> join( Vertex<K, VV> vertex, Tuple2<K, Either<NullValue, Message>> message) { outTuple.f0 = vertex; outTuple.f1 = message.f1; return outTuple; } }
@ForwardedFieldsFirst("1 -> 0") @ForwardedFieldsSecond("1 -> 1") private static class ForwardedBothAnnotationJoin<A, B, C, D> implements JoinFunction<Tuple2<A, B>, Tuple2<C, D>, Tuple2<B, D>> { @Override public Tuple2<B, D> join(Tuple2<A, B> first, Tuple2<C, D> second) { return new Tuple2<B, D>(first.f1, second.f1); } }
@ForwardedFieldsFirst("f0->f0") @ForwardedFieldsSecond("f0->f0") private static class DummyCoGroupFunction implements CoGroupFunction<Tuple2<Long, Long>, Tuple2<Long, Long>, Tuple2<Long, Long>> { @Override public void coGroup(Iterable<Tuple2<Long, Long>> first, Iterable<Tuple2<Long, Long>> second, Collector<Tuple2<Long, Long>> out) throws Exception { // won't be executed } } }
@ForwardedFieldsFirst("f1->f1") @ForwardedFieldsSecond("f1->f0") private static final class NeighborWithComponentIDJoin implements JoinFunction<Tuple2<Long, Long>, Tuple2<Long, Long>, Tuple2<Long, Long>> { @Override public Tuple2<Long, Long> join(Tuple2<Long, Long> vertexWithComponent, Tuple2<Long, Long> edge) { return new Tuple2<Long, Long>(edge.f1, vertexWithComponent.f1); } }
@ForwardedFieldsFirst("f1->f1") @ForwardedFieldsSecond("f1->f0") private static class Join1 implements JoinFunction<Tuple2<Long, Long>, Tuple2<Long, Long>, Tuple2<Long, Long>> { @Override public Tuple2<Long, Long> join(Tuple2<Long, Long> vertexWithComponent, Tuple2<Long, Long> edge) { return new Tuple2<Long, Long>(edge.f1, vertexWithComponent.f1); } }