forwardedFirst = ((ForwardedFieldsFirst) ann).value(); } else if (ann instanceof ForwardedFieldsSecond) { forwardedSecond = ((ForwardedFieldsSecond) ann).value();
@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; } }
@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; } }
/** * Left projection with id obtained. * @param <K> Element where the id is extracted * */ @FunctionAnnotation.ForwardedFieldsFirst("id -> *") public class LeftElementId<K extends EPGMElement> implements KeySelector<Tuple2<K, GradoopId>, GradoopId> { @Override public GradoopId getKey(Tuple2<K, GradoopId> value) throws Exception { return value.f0.getId(); } }
/** * Left projection with id obtained. * @param <K> Element where the id is extracted * */ @FunctionAnnotation.ForwardedFieldsFirst("id -> *") public class LeftElementId<K extends EPGMElement> implements KeySelector<Tuple2<K, GradoopId>, GradoopId> { @Override public GradoopId getKey(Tuple2<K, GradoopId> value) throws Exception { return value.f0.getId(); } }
/** * Emit the candidate (Vertex-ID, Component-ID) pair if and only if the * candidate component ID is less than the vertex's current component ID. */ @ForwardedFieldsFirst("*") public static final class ComponentIdFilter implements FlatJoinFunction<Tuple2<Long, Long>, Tuple2<Long, Long>, Tuple2<Long, Long>> { @Override public void join(Tuple2<Long, Long> candidate, Tuple2<Long, Long> old, Collector<Tuple2<Long, Long>> out) { if (candidate.f1 < old.f1) { out.collect(candidate); } } }
/** * Emit the candidate (Vertex-ID, Component-ID) pair if and only if the * candidate component ID is less than the vertex's current component ID. */ @ForwardedFieldsFirst("*") public static final class ComponentIdFilter implements FlatJoinFunction<Tuple2<Long, Long>, Tuple2<Long, Long>, Tuple2<Long, Long>> { @Override public void join(Tuple2<Long, Long> candidate, Tuple2<Long, Long> old, Collector<Tuple2<Long, Long>> out) { if (candidate.f1 < old.f1) { out.collect(candidate); } } }
/** * 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); } }
/** * 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); } }
@ForwardedFieldsFirst("*->0") @ForwardedFieldsSecond("*->1") @Internal private static final class DefaultFlatJoinFunction<T1, T2> extends RichFlatJoinFunction<T1, T2, Tuple2<T1, T2>> { private static final long serialVersionUID = 1L; private final Tuple2<T1, T2> outTuple = new Tuple2<>(); @Override public void join(T1 first, T2 second, Collector<Tuple2<T1, T2>> out) throws Exception { outTuple.f0 = first; outTuple.f1 = second; out.collect(outTuple); } }
@ForwardedFieldsFirst("*->0") @ForwardedFieldsSecond("*->1") @Internal private static final class DefaultFlatJoinFunction<T1, T2> extends RichFlatJoinFunction<T1, T2, Tuple2<T1, T2>> { private static final long serialVersionUID = 1L; private final Tuple2<T1, T2> outTuple = new Tuple2<>(); @Override public void join(T1 first, T2 second, Collector<Tuple2<T1, T2>> out) throws Exception { outTuple.f0 = first; outTuple.f1 = second; out.collect(outTuple); } }
/** * 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); } }
/** * 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); } }
/** * (label, graphId) |><| graphHead => (label, graphHead) */ @FunctionAnnotation.ForwardedFieldsFirst("f1->f0") public class GraphHeadGroup implements JoinFunction<GraphHeadString, GraphHead, Tuple2<String, GraphHead>> { @Override public Tuple2<String, GraphHead> join(GraphHeadString graphHeadString, GraphHead graphHead) throws Exception { return new Tuple2<>(graphHeadString.getLabel(), graphHead); } }
@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)); } }
/** * (label, graphId) |><| graphHead => (label, graphHead) */ @FunctionAnnotation.ForwardedFieldsFirst("f1->f0") public class GraphHeadGroup implements JoinFunction<GraphHeadString, GraphHead, Tuple2<String, GraphHead>> { @Override public Tuple2<String, GraphHead> join(GraphHeadString graphHeadString, GraphHead graphHead) throws Exception { return new Tuple2<>(graphHeadString.getLabel(), graphHead); } }
@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())); } }
@ForwardedFieldsFirst("f0; f1; f2") private static final class JoinWithVerticesOnTrg<K, VV, EV> implements JoinFunction<Edge<K, EV>, Vertex<K, VV>, Edge<K, EV>> { @Override public Edge<K, EV> join(Edge<K, EV> edge, Vertex<K, VV> vertex) throws Exception { return edge; } }
@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())); } }
@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)); } }