You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by gr...@apache.org on 2017/01/17 21:35:44 UTC
[1/6] flink git commit: [FLINK-5461] [gelly] Remove Superflous
TypeInformation Declaration
Repository: flink
Updated Branches:
refs/heads/master ece899a9f -> cb2820675
[FLINK-5461] [gelly] Remove Superflous TypeInformation Declaration
FLINK-4624 updated Gelly's Summarization algorithm to use
Either<NullValue, VV> in order to support types for which the
serialization does not support null values. This required the use of
explicit TypeInformation due to TypeExtractor. FLINK-4673 created a
TypeInfoFactory for EitherType so the explicit TypeInformation can be
removed.
This closes #3096
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/b408d61f
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/b408d61f
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/b408d61f
Branch: refs/heads/master
Commit: b408d61f707806d2a188c55065d1187f4f05099a
Parents: ece899a
Author: Greg Hogan <co...@greghogan.com>
Authored: Wed Jan 11 13:43:58 2017 -0500
Committer: Greg Hogan <co...@greghogan.com>
Committed: Tue Jan 17 15:37:53 2017 -0500
----------------------------------------------------------------------
.../flink/graph/library/Summarization.java | 26 +++-----------------
1 file changed, 4 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/b408d61f/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/Summarization.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/Summarization.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/Summarization.java
index 2361247..fed4d89 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/Summarization.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/Summarization.java
@@ -23,15 +23,10 @@ import org.apache.flink.api.common.functions.GroupReduceFunction;
import org.apache.flink.api.common.functions.JoinFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.functions.RichGroupReduceFunction;
-import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
-import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.functions.FunctionAnnotation;
-import org.apache.flink.api.java.operators.GroupReduceOperator;
-import org.apache.flink.api.java.operators.UnsortedGrouping;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.tuple.Tuple4;
-import org.apache.flink.api.java.typeutils.TupleTypeInfo;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.graph.Edge;
import org.apache.flink.graph.Graph;
@@ -97,31 +92,18 @@ public class Summarization<K, VV, EV>
@Override
public Graph<K, VertexValue<VV>, EdgeValue<EV>> run(Graph<K, VV, EV> input) throws Exception {
- // create type infos for correct return type definitions
- // Note: this use of type hints is only required due to
- // limitations of the type parser for the Either type
- // which are being fixed in FLINK-4673
- TypeInformation<K> keyType = ((TupleTypeInfo<?>) input.getVertices().getType()).getTypeAt(0);
- TypeInformation<VV> valueType = ((TupleTypeInfo<?>) input.getVertices().getType()).getTypeAt(1);
- @SuppressWarnings("unchecked")
- TupleTypeInfo<Vertex<K, VertexValue<VV>>> vertexType = (TupleTypeInfo<Vertex<K, VertexValue<VV>>>) new TupleTypeInfo(
- Vertex.class, keyType, new TupleTypeInfo(VertexValue.class, valueType, BasicTypeInfo.LONG_TYPE_INFO));
-
// -------------------------
// build super vertices
// -------------------------
- // group vertices by value
- UnsortedGrouping<Vertex<K, VV>> vertexUnsortedGrouping = input.getVertices()
- .groupBy(1);
- // reduce vertex group and create vertex group items
- GroupReduceOperator<Vertex<K, VV>, VertexGroupItem<K, VV>> vertexGroupItems = vertexUnsortedGrouping
+ // group vertices by value and create vertex group items
+ DataSet<VertexGroupItem<K, VV>> vertexGroupItems = input.getVertices()
+ .groupBy(1)
.reduceGroup(new VertexGroupReducer<K, VV>());
// create super vertices
DataSet<Vertex<K, VertexValue<VV>>> summarizedVertices = vertexGroupItems
.filter(new VertexGroupItemToSummarizedVertexFilter<K, VV>())
- .map(new VertexGroupItemToSummarizedVertexMapper<K, VV>())
- .returns(vertexType);
+ .map(new VertexGroupItemToSummarizedVertexMapper<K, VV>());
// -------------------------
// build super edges
[3/6] flink git commit: [hotfix] [gelly] Improve generic type
formatting
Posted by gr...@apache.org.
[hotfix] [gelly] Improve generic type formatting
Add spacing between type parameters.
For example, 'Vertex<K,VV>' has been updated to 'Vertex<K, VV>'.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/53716a4d
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/53716a4d
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/53716a4d
Branch: refs/heads/master
Commit: 53716a4da1732ee66c7906772bd5bfcd2218b3e1
Parents: b408d61
Author: Greg Hogan <co...@greghogan.com>
Authored: Tue Jan 17 14:25:37 2017 -0500
Committer: Greg Hogan <co...@greghogan.com>
Committed: Tue Jan 17 15:38:24 2017 -0500
----------------------------------------------------------------------
.../apache/flink/graph/drivers/Graph500.java | 2 +-
.../graph/examples/data/TriangleCountData.java | 10 ++--
.../graph/library/TriangleEnumeratorITCase.java | 6 +--
.../test/examples/IncrementalSSSPITCase.java | 2 +-
.../main/java/org/apache/flink/graph/Graph.java | 30 +++++------
.../asm/translate/TranslateEdgeValues.java | 2 +-
.../graph/asm/translate/TranslateGraphIds.java | 2 +-
.../graph/generator/AbstractGraphGenerator.java | 2 +-
.../flink/graph/generator/CompleteGraph.java | 12 ++---
.../flink/graph/generator/CycleGraph.java | 2 +-
.../flink/graph/generator/EmptyGraph.java | 10 ++--
.../flink/graph/generator/GraphGenerator.java | 4 +-
.../graph/generator/GraphGeneratorUtils.java | 18 +++----
.../apache/flink/graph/generator/GridGraph.java | 20 +++----
.../apache/flink/graph/generator/PathGraph.java | 2 +-
.../apache/flink/graph/generator/RMatGraph.java | 14 ++---
.../graph/generator/SingletonEdgeGraph.java | 12 ++---
.../apache/flink/graph/generator/StarGraph.java | 14 ++---
.../flink/graph/library/TriangleEnumerator.java | 10 ++--
.../directed/LocalClusteringCoefficient.java | 2 +-
.../undirected/LocalClusteringCoefficient.java | 4 +-
.../graph/pregel/VertexCentricIteration.java | 2 +-
.../graph/spargel/ScatterGatherIteration.java | 4 +-
.../proxy/GraphAlgorithmWrappingDataSet.java | 2 +-
.../org/apache/flink/graph/asm/AsmTestBase.java | 16 +++---
.../graph/asm/simple/directed/SimplifyTest.java | 4 +-
.../asm/simple/undirected/SimplifyTest.java | 6 +--
.../graph/asm/translate/TranslateTest.java | 2 +-
.../graph/generator/CompleteGraphTest.java | 10 ++--
.../flink/graph/generator/CycleGraphTest.java | 10 ++--
.../flink/graph/generator/EmptyGraphTest.java | 10 ++--
.../flink/graph/generator/GridGraphTest.java | 6 +--
.../graph/generator/HypercubeGraphTest.java | 6 +--
.../flink/graph/generator/PathGraphTest.java | 10 ++--
.../flink/graph/generator/RMatGraphTest.java | 8 +--
.../graph/generator/SingletonEdgeGraphTest.java | 10 ++--
.../flink/graph/generator/StarGraphTest.java | 10 ++--
.../apache/flink/graph/generator/TestUtils.java | 6 +--
.../graph/library/link_analysis/HITSTest.java | 4 +-
.../flink/graph/pregel/PregelCompilerTest.java | 24 ++++-----
.../graph/pregel/PregelTranslationTest.java | 16 +++---
.../graph/spargel/SpargelCompilerTest.java | 24 ++++-----
.../graph/spargel/SpargelTranslationTest.java | 4 +-
.../test/ScatterGatherConfigurationITCase.java | 6 +--
.../apache/flink/graph/test/TestGraphUtils.java | 20 +++----
.../test/operations/FromCollectionITCase.java | 13 ++---
.../test/operations/GraphCreationITCase.java | 18 +++----
.../operations/GraphCreationWithCsvITCase.java | 16 +++---
.../GraphCreationWithMapperITCase.java | 16 +++---
.../test/operations/GraphMutationsITCase.java | 56 ++++++++++----------
.../test/operations/GraphOperationsITCase.java | 20 +++----
.../test/operations/JoinWithEdgesITCase.java | 34 ++++++------
.../test/operations/JoinWithVerticesITCase.java | 24 ++++-----
.../operations/ReduceOnEdgesMethodsITCase.java | 36 ++++++-------
.../ReduceOnNeighborMethodsITCase.java | 30 +++++------
55 files changed, 332 insertions(+), 331 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/Graph500.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/Graph500.java b/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/Graph500.java
index 51ef66f..3509d2e 100644
--- a/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/Graph500.java
+++ b/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/Graph500.java
@@ -103,7 +103,7 @@ public class Graph500 {
graph = graph.run(new Simplify<LongValue, NullValue, NullValue>(clipAndFlip));
}
- DataSet<Tuple2<LongValue,LongValue>> edges = graph
+ DataSet<Tuple2<LongValue, LongValue>> edges = graph
.getEdges()
.project(0, 1);
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/data/TriangleCountData.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/data/TriangleCountData.java b/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/data/TriangleCountData.java
index a14010f..cf3a715 100644
--- a/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/data/TriangleCountData.java
+++ b/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/data/TriangleCountData.java
@@ -53,11 +53,11 @@ public class TriangleCountData {
public static final String RESULTED_NUMBER_OF_TRIANGLES = "3";
- public static List<Tuple3<Long,Long,Long>> getListOfTriangles() {
- ArrayList<Tuple3<Long,Long,Long>> ret = new ArrayList<>(3);
- ret.add(new Tuple3<>(1L,2L,3L));
- ret.add(new Tuple3<>(2L,3L,6L));
- ret.add(new Tuple3<>(4L,3L,5L));
+ public static List<Tuple3<Long, Long, Long>> getListOfTriangles() {
+ ArrayList<Tuple3<Long, Long, Long>> ret = new ArrayList<>(3);
+ ret.add(new Tuple3<>(1L, 2L, 3L));
+ ret.add(new Tuple3<>(2L, 3L, 6L));
+ ret.add(new Tuple3<>(4L, 3L, 5L));
return ret;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/TriangleEnumeratorITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/TriangleEnumeratorITCase.java b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/TriangleEnumeratorITCase.java
index 9550405..176a7e1 100644
--- a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/TriangleEnumeratorITCase.java
+++ b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/TriangleEnumeratorITCase.java
@@ -46,11 +46,11 @@ public class TriangleEnumeratorITCase extends MultipleProgramsTestBase {
Graph<Long, NullValue, NullValue> graph = Graph.fromDataSet(TriangleCountData.getDefaultEdgeDataSet(env),
env);
- List<Tuple3<Long,Long,Long>> actualOutput = graph.run(new TriangleEnumerator<Long, NullValue, NullValue>()).collect();
- List<Tuple3<Long,Long,Long>> expectedResult = TriangleCountData.getListOfTriangles();
+ List<Tuple3<Long, Long, Long>> actualOutput = graph.run(new TriangleEnumerator<Long, NullValue, NullValue>()).collect();
+ List<Tuple3<Long, Long, Long>> expectedResult = TriangleCountData.getListOfTriangles();
Assert.assertEquals(expectedResult.size(), actualOutput.size());
- for(Tuple3<Long,Long,Long> resultTriangle:actualOutput) {
+ for(Tuple3<Long, Long, Long> resultTriangle:actualOutput) {
Assert.assertTrue(expectedResult.indexOf(resultTriangle)>=0);
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/examples/IncrementalSSSPITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/examples/IncrementalSSSPITCase.java b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/examples/IncrementalSSSPITCase.java
index 24b8cf1..de92666 100644
--- a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/examples/IncrementalSSSPITCase.java
+++ b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/examples/IncrementalSSSPITCase.java
@@ -82,7 +82,7 @@ public class IncrementalSSSPITCase extends MultipleProgramsTestBase {
public void testIncrementalSSSP() throws Exception {
IncrementalSSSP.main(new String[]{verticesPath, edgesPath, edgesInSSSPPath,
IncrementalSSSPData.SRC_EDGE_TO_BE_REMOVED, IncrementalSSSPData.TRG_EDGE_TO_BE_REMOVED,
- IncrementalSSSPData.VAL_EDGE_TO_BE_REMOVED,resultPath, IncrementalSSSPData.NUM_VERTICES + ""});
+ IncrementalSSSPData.VAL_EDGE_TO_BE_REMOVED, resultPath, IncrementalSSSPData.NUM_VERTICES + ""});
expected = IncrementalSSSPData.RESULTED_VERTICES;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
index 093b804..dae7a11 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
@@ -544,7 +544,7 @@ public class Graph<K, VV, EV> {
* @param returnType the explicit return type.
* @return a new graph
*/
- public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper, TypeInformation<Vertex<K,NV>> returnType) {
+ public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper, TypeInformation<Vertex<K, NV>> returnType) {
DataSet<Vertex<K, NV>> mappedVertices = vertices.map(
new MapFunction<Vertex<K, VV>, Vertex<K, NV>>() {
private Vertex<K, NV> output = new Vertex<>();
@@ -588,7 +588,7 @@ public class Graph<K, VV, EV> {
* @param returnType the explicit return type.
* @return a new graph
*/
- public <NV> Graph<K, VV, NV> mapEdges(final MapFunction<Edge<K, EV>, NV> mapper, TypeInformation<Edge<K,NV>> returnType) {
+ public <NV> Graph<K, VV, NV> mapEdges(final MapFunction<Edge<K, EV>, NV> mapper, TypeInformation<Edge<K, NV>> returnType) {
DataSet<Edge<K, NV>> mappedEdges = edges.map(
new MapFunction<Edge<K, EV>, Edge<K, NV>>() {
private Edge<K, NV> output = new Edge<>();
@@ -924,7 +924,7 @@ public class Graph<K, VV, EV> {
private Tuple2<K, LongValue> vertexDegree = new Tuple2<>(null, degree);
@SuppressWarnings("unused")
- public void coGroup(Iterable<Vertex<K, VV>> vertex, Iterable<Edge<K, EV>> outEdges,
+ public void coGroup(Iterable<Vertex<K, VV>> vertex, Iterable<Edge<K, EV>> outEdges,
Collector<Tuple2<K, LongValue>> out) {
long count = 0;
for (Edge<K, EV> edge : outEdges) {
@@ -1217,7 +1217,7 @@ public class Graph<K, VV, EV> {
this.function = fun;
}
- public void coGroup(Iterable<Vertex<K, VV>> vertex, final Iterable<Tuple2<K, Edge<K, EV>>> keysWithEdges,
+ public void coGroup(Iterable<Vertex<K, VV>> vertex, final Iterable<Tuple2<K, Edge<K, EV>>> keysWithEdges,
Collector<T> out) throws Exception {
final Iterator<Edge<K, EV>> edgesIterator = new Iterator<Edge<K, EV>>() {
@@ -1416,9 +1416,9 @@ public class Graph<K, VV, EV> {
*/
public Graph<K, VV, EV> addEdges(List<Edge<K, EV>> newEdges) {
- DataSet<Edge<K,EV>> newEdgesDataSet = this.context.fromCollection(newEdges);
+ DataSet<Edge<K, EV>> newEdgesDataSet = this.context.fromCollection(newEdges);
- DataSet<Edge<K,EV>> validNewEdges = this.getVertices().join(newEdgesDataSet)
+ DataSet<Edge<K, EV>> validNewEdges = this.getVertices().join(newEdgesDataSet)
.where(0).equalTo(0)
.with(new JoinVerticesWithEdgesOnSrc<K, VV, EV>()).name("Join with source")
.join(this.getVertices()).where(1).equalTo(0)
@@ -1516,7 +1516,7 @@ public class Graph<K, VV, EV> {
}
@ForwardedFieldsSecond("f0; f1; f2")
- private static final class ProjectEdgeToBeRemoved<K,VV,EV> implements JoinFunction<Vertex<K, VV>, Edge<K, EV>, Edge<K, EV>> {
+ private static final class ProjectEdgeToBeRemoved<K, VV, EV> implements JoinFunction<Vertex<K, VV>, Edge<K, EV>, Edge<K, EV>> {
@Override
public Edge<K, EV> join(Vertex<K, VV> vertex, Edge<K, EV> edge) throws Exception {
return edge;
@@ -1559,12 +1559,12 @@ public class Graph<K, VV, EV> {
public Graph<K, VV, EV> removeEdges(List<Edge<K, EV>> edgesToBeRemoved) {
DataSet<Edge<K, EV>> newEdges = getEdges().coGroup(this.context.fromCollection(edgesToBeRemoved))
- .where(0,1).equalTo(0,1).with(new EdgeRemovalCoGroup<K, EV>()).name("Remove edges");
+ .where(0, 1).equalTo(0, 1).with(new EdgeRemovalCoGroup<K, EV>()).name("Remove edges");
return new Graph<>(this.vertices, newEdges, context);
}
- private static final class EdgeRemovalCoGroup<K,EV> implements CoGroupFunction<Edge<K, EV>, Edge<K, EV>, Edge<K, EV>> {
+ private static final class EdgeRemovalCoGroup<K, EV> implements CoGroupFunction<Edge<K, EV>, Edge<K, EV>, Edge<K, EV>> {
@Override
public void coGroup(Iterable<Edge<K, EV>> edge, Iterable<Edge<K, EV>> edgeToBeRemoved,
@@ -1608,8 +1608,8 @@ public class Graph<K, VV, EV> {
* @param graph the graph to perform difference with
* @return a new graph where the common vertices and edges have been removed
*/
- public Graph<K,VV,EV> difference(Graph<K,VV,EV> graph) {
- DataSet<Vertex<K,VV>> removeVerticesData = graph.getVertices();
+ public Graph<K, VV, EV> difference(Graph<K, VV, EV> graph) {
+ DataSet<Vertex<K, VV>> removeVerticesData = graph.getVertices();
return this.removeVertices(removeVerticesData);
}
@@ -1688,7 +1688,7 @@ public class Graph<K, VV, EV> {
* @param <EV> edge value type
*/
private static final class MatchingEdgeReducer<K, EV>
- implements CoGroupFunction<Edge<K,EV>, Edge<K,EV>, Edge<K, EV>> {
+ implements CoGroupFunction<Edge<K, EV>, Edge<K, EV>, Edge<K, EV>> {
@Override
public void coGroup(Iterable<Edge<K, EV>> edgesLeft, Iterable<Edge<K, EV>> edgesRight, Collector<Edge<K, EV>> out)
@@ -2149,12 +2149,12 @@ public class Graph<K, VV, EV> {
public void coGroup(Iterable<Vertex<K, VV>> vertex, Iterable<Tuple2<Edge<K, EV>, Vertex<K, VV>>> neighbors,
Collector<T> out) throws Exception {
- function.iterateNeighbors(vertex.iterator().next(), neighbors, out);
+ function.iterateNeighbors(vertex.iterator().next(), neighbors, out);
}
@Override
public TypeInformation<T> getProducedType() {
- return TypeExtractor.createTypeInfo(NeighborsFunctionWithVertexValue.class, function.getClass(), 3, null, null);
+ return TypeExtractor.createTypeInfo(NeighborsFunctionWithVertexValue.class, function.getClass(), 3, null, null);
}
}
@@ -2209,7 +2209,7 @@ public class Graph<K, VV, EV> {
@Override
public TypeInformation<T> getProducedType() {
- return TypeExtractor.createTypeInfo(NeighborsFunctionWithVertexValue.class, function.getClass(), 3, null, null);
+ return TypeExtractor.createTypeInfo(NeighborsFunctionWithVertexValue.class, function.getClass(), 3, null, null);
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateEdgeValues.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateEdgeValues.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateEdgeValues.java
index b2b7594..c8000e4 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateEdgeValues.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateEdgeValues.java
@@ -39,7 +39,7 @@ public class TranslateEdgeValues<K, VV, OLD, NEW>
extends GraphAlgorithmWrappingGraph<K, VV, OLD, K, VV, NEW> {
// Required configuration
- private TranslateFunction<OLD,NEW> translator;
+ private TranslateFunction<OLD, NEW> translator;
// Optional configuration
private int parallelism = PARALLELISM_DEFAULT;
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateGraphIds.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateGraphIds.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateGraphIds.java
index e079a41..58cb7e2 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateGraphIds.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/TranslateGraphIds.java
@@ -41,7 +41,7 @@ public class TranslateGraphIds<OLD, NEW, VV, EV>
extends GraphAlgorithmWrappingGraph<OLD, VV, EV, NEW, VV, EV> {
// Required configuration
- private TranslateFunction<OLD,NEW> translator;
+ private TranslateFunction<OLD, NEW> translator;
// Optional configuration
private int parallelism = PARALLELISM_DEFAULT;
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/AbstractGraphGenerator.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/AbstractGraphGenerator.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/AbstractGraphGenerator.java
index 7f37356..58266a5 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/AbstractGraphGenerator.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/AbstractGraphGenerator.java
@@ -27,7 +27,7 @@ implements GraphGenerator<K, VV, EV> {
protected int parallelism = PARALLELISM_DEFAULT;
@Override
- public GraphGenerator<K,VV,EV> setParallelism(int parallelism) {
+ public GraphGenerator<K, VV, EV> setParallelism(int parallelism) {
this.parallelism = parallelism;
return this;
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CompleteGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CompleteGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CompleteGraph.java
index 5339b14..a4996ab 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CompleteGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CompleteGraph.java
@@ -58,14 +58,14 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
@Override
- public Graph<LongValue,NullValue,NullValue> generate() {
+ public Graph<LongValue, NullValue, NullValue> generate() {
// Vertices
- DataSet<Vertex<LongValue,NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
+ DataSet<Vertex<LongValue, NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
// Edges
LongValueSequenceIterator iterator = new LongValueSequenceIterator(0, this.vertexCount - 1);
- DataSet<Edge<LongValue,NullValue>> edges = env
+ DataSet<Edge<LongValue, NullValue>> edges = env
.fromParallelCollection(iterator, LongValue.class)
.setParallelism(parallelism)
.name("Edge iterators")
@@ -79,20 +79,20 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
@ForwardedFields("*->f0")
public class LinkVertexToAll
- implements FlatMapFunction<LongValue, Edge<LongValue,NullValue>> {
+ implements FlatMapFunction<LongValue, Edge<LongValue, NullValue>> {
private final long vertexCount;
private LongValue target = new LongValue();
- private Edge<LongValue,NullValue> edge = new Edge<>(null, target, NullValue.getInstance());
+ private Edge<LongValue, NullValue> edge = new Edge<>(null, target, NullValue.getInstance());
public LinkVertexToAll(long vertex_count) {
this.vertexCount = vertex_count;
}
@Override
- public void flatMap(LongValue source, Collector<Edge<LongValue,NullValue>> out)
+ public void flatMap(LongValue source, Collector<Edge<LongValue, NullValue>> out)
throws Exception {
edge.f0 = source;
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CycleGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CycleGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CycleGraph.java
index 2671efe..ce8b467 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CycleGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CycleGraph.java
@@ -51,7 +51,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
@Override
- public Graph<LongValue,NullValue,NullValue> generate() {
+ public Graph<LongValue, NullValue, NullValue> generate() {
return new GridGraph(env)
.addDimension(vertexCount, true)
.setParallelism(parallelism)
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EmptyGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EmptyGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EmptyGraph.java
index 05bfd89..7ec368b 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EmptyGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EmptyGraph.java
@@ -60,16 +60,16 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
@Override
- public Graph<LongValue,NullValue,NullValue> generate() {
+ public Graph<LongValue, NullValue, NullValue> generate() {
// Vertices
- DataSet<Vertex<LongValue,NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
+ DataSet<Vertex<LongValue, NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
// Edges
- TypeInformation<Edge<LongValue,NullValue>> typeInformation = new TupleTypeInfo<>(
+ TypeInformation<Edge<LongValue, NullValue>> typeInformation = new TupleTypeInfo<>(
ValueTypeInfo.LONG_VALUE_TYPE_INFO, ValueTypeInfo.LONG_VALUE_TYPE_INFO, ValueTypeInfo.NULL_VALUE_TYPE_INFO);
- DataSource<Edge<LongValue,NullValue>> edges = env
- .fromCollection(Collections.<Edge<LongValue,NullValue>>emptyList(), typeInformation)
+ DataSource<Edge<LongValue, NullValue>> edges = env
+ .fromCollection(Collections.<Edge<LongValue ,NullValue>>emptyList(), typeInformation)
.setParallelism(parallelism)
.name("Empty edge set");
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGenerator.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGenerator.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGenerator.java
index 8fece81..f972d98 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGenerator.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGenerator.java
@@ -39,7 +39,7 @@ public interface GraphGenerator<K, VV, EV> {
*
* @return generated graph
*/
- Graph<K,VV,EV> generate();
+ Graph<K, VV, EV> generate();
/**
* Override the operator parallelism.
@@ -47,5 +47,5 @@ public interface GraphGenerator<K, VV, EV> {
* @param parallelism operator parallelism
* @return this
*/
- GraphGenerator<K,VV,EV> setParallelism(int parallelism);
+ GraphGenerator<K, VV, EV> setParallelism(int parallelism);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java
index 01cb2d1..485394c 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java
@@ -42,7 +42,7 @@ public class GraphGeneratorUtils {
* @param vertexCount number of sequential vertex labels
* @return {@link DataSet} of sequentially labeled {@link Vertex Vertices}
*/
- public static DataSet<Vertex<LongValue,NullValue>> vertexSequence(ExecutionEnvironment env, int parallelism, long vertexCount) {
+ public static DataSet<Vertex<LongValue, NullValue>> vertexSequence(ExecutionEnvironment env, int parallelism, long vertexCount) {
LongValueSequenceIterator iterator = new LongValueSequenceIterator(0, vertexCount-1);
DataSource<LongValue> vertexLabels = env
@@ -58,9 +58,9 @@ public class GraphGeneratorUtils {
@ForwardedFields("*->f0")
private static class CreateVertex
- implements MapFunction<LongValue, Vertex<LongValue,NullValue>> {
+ implements MapFunction<LongValue, Vertex<LongValue, NullValue>> {
- private Vertex<LongValue,NullValue> vertex = new Vertex<>(null, NullValue.getInstance());
+ private Vertex<LongValue, NullValue> vertex = new Vertex<>(null, NullValue.getInstance());
@Override
public Vertex<LongValue, NullValue> map(LongValue value)
@@ -84,8 +84,8 @@ public class GraphGeneratorUtils {
*
* @see Graph#fromDataSet(DataSet, DataSet, ExecutionEnvironment)
*/
- public static <K,EV> DataSet<Vertex<K,NullValue>> vertexSet(DataSet<Edge<K,EV>> edges, int parallelism) {
- DataSet<Vertex<K,NullValue>> vertexSet = edges
+ public static <K, EV> DataSet<Vertex<K, NullValue>> vertexSet(DataSet<Edge<K, EV>> edges, int parallelism) {
+ DataSet<Vertex<K, NullValue>> vertexSet = edges
.flatMap(new EmitSrcAndTarget<K, EV>())
.setParallelism(parallelism)
.name("Emit source and target labels");
@@ -99,13 +99,13 @@ public class GraphGeneratorUtils {
/**
* @see Graph.EmitSrcAndTarget
*/
- private static final class EmitSrcAndTarget<K,EV>
- implements FlatMapFunction<Edge<K,EV>, Vertex<K,NullValue>> {
+ private static final class EmitSrcAndTarget<K, EV>
+ implements FlatMapFunction<Edge<K, EV>, Vertex<K, NullValue>> {
- private Vertex<K,NullValue> output = new Vertex<>(null, new NullValue());
+ private Vertex<K, NullValue> output = new Vertex<>(null, new NullValue());
@Override
- public void flatMap(Edge<K,EV> value, Collector<Vertex<K,NullValue>> out) throws Exception {
+ public void flatMap(Edge<K, EV> value, Collector<Vertex<K, NullValue>> out) throws Exception {
output.f0 = value.f0;
out.collect(output);
output.f0 = value.f1;
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java
index 399a2f9..74ea764 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java
@@ -44,7 +44,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
private final ExecutionEnvironment env;
// Required configuration
- private List<Tuple2<Long,Boolean>> dimensions = new ArrayList<>();
+ private List<Tuple2<Long, Boolean>> dimensions = new ArrayList<>();
private long vertexCount = 1;
@@ -84,18 +84,18 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
@Override
- public Graph<LongValue,NullValue,NullValue> generate() {
+ public Graph<LongValue, NullValue, NullValue> generate() {
if (dimensions.isEmpty()) {
throw new RuntimeException("No dimensions added to GridGraph");
}
// Vertices
- DataSet<Vertex<LongValue,NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
+ DataSet<Vertex<LongValue, NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
// Edges
LongValueSequenceIterator iterator = new LongValueSequenceIterator(0, this.vertexCount - 1);
- DataSet<Edge<LongValue,NullValue>> edges = env
+ DataSet<Edge<LongValue, NullValue>> edges = env
.fromParallelCollection(iterator, LongValue.class)
.setParallelism(parallelism)
.name("Edge iterators")
@@ -109,23 +109,23 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
@ForwardedFields("*->f0")
public class LinkVertexToNeighbors
- implements FlatMapFunction<LongValue, Edge<LongValue,NullValue>> {
+ implements FlatMapFunction<LongValue, Edge<LongValue, NullValue>> {
private long vertexCount;
- private List<Tuple2<Long,Boolean>> dimensions;
+ private List<Tuple2<Long, Boolean>> dimensions;
private LongValue target = new LongValue();
- private Edge<LongValue,NullValue> edge = new Edge<>(null, target, NullValue.getInstance());
+ private Edge<LongValue, NullValue> edge = new Edge<>(null, target, NullValue.getInstance());
- public LinkVertexToNeighbors(long vertexCount, List<Tuple2<Long,Boolean>> dimensions) {
+ public LinkVertexToNeighbors(long vertexCount, List<Tuple2<Long, Boolean>> dimensions) {
this.vertexCount = vertexCount;
this.dimensions = dimensions;
}
@Override
- public void flatMap(LongValue source, Collector<Edge<LongValue,NullValue>> out)
+ public void flatMap(LongValue source, Collector<Edge<LongValue, NullValue>> out)
throws Exception {
edge.f0 = source;
long val = source.getValue();
@@ -136,7 +136,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
// the value in the remaining dimensions
long remainder = val;
- for (Tuple2<Long,Boolean> dimension : dimensions) {
+ for (Tuple2<Long, Boolean> dimension : dimensions) {
increment /= dimension.f0;
// the index within this dimension
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/PathGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/PathGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/PathGraph.java
index 1aec723..db5e6bf 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/PathGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/PathGraph.java
@@ -51,7 +51,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
@Override
- public Graph<LongValue,NullValue,NullValue> generate() {
+ public Graph<LongValue, NullValue, NullValue> generate() {
return new GridGraph(env)
.addDimension(vertexCount, false)
.setParallelism(parallelism)
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java
index 8a17b13..2a80a37 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java
@@ -139,7 +139,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
@Override
- public Graph<LongValue,NullValue,NullValue> generate() {
+ public Graph<LongValue, NullValue, NullValue> generate() {
int scale = Long.SIZE - Long.numberOfLeadingZeros(vertexCount - 1);
// Edges
@@ -148,7 +148,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
List<BlockInfo<T>> generatorBlocks = randomGenerableFactory
.getRandomGenerables(edgeCount, cyclesPerEdge);
- DataSet<Edge<LongValue,NullValue>> edges = env
+ DataSet<Edge<LongValue, NullValue>> edges = env
.fromCollection(generatorBlocks)
.name("Random generators")
.rebalance()
@@ -159,14 +159,14 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
.name("RMat graph edges");
// Vertices
- DataSet<Vertex<LongValue,NullValue>> vertices = GraphGeneratorUtils.vertexSet(edges, parallelism);
+ DataSet<Vertex<LongValue, NullValue>> vertices = GraphGeneratorUtils.vertexSet(edges, parallelism);
// Graph
return Graph.fromDataSet(vertices, edges, env);
}
private static final class GenerateEdges<T extends RandomGenerator>
- implements FlatMapFunction<BlockInfo<T>, Edge<LongValue,NullValue>> {
+ implements FlatMapFunction<BlockInfo<T>, Edge<LongValue, NullValue>> {
// Configuration
private final long vertexCount;
@@ -190,9 +190,9 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
private LongValue target = new LongValue();
- private Edge<LongValue,NullValue> sourceToTarget = new Edge<>(source, target, NullValue.getInstance());
+ private Edge<LongValue, NullValue> sourceToTarget = new Edge<>(source, target, NullValue.getInstance());
- private Edge<LongValue,NullValue> targetToSource = new Edge<>(target, source, NullValue.getInstance());
+ private Edge<LongValue, NullValue> targetToSource = new Edge<>(target, source, NullValue.getInstance());
public GenerateEdges(long vertexCount, int scale, float A, float B, float C, boolean noiseEnabled, float noise) {
this.vertexCount = vertexCount;
@@ -206,7 +206,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
@Override
- public void flatMap(BlockInfo<T> blockInfo, Collector<Edge<LongValue,NullValue>> out)
+ public void flatMap(BlockInfo<T> blockInfo, Collector<Edge<LongValue, NullValue>> out)
throws Exception {
RandomGenerator rng = blockInfo.getRandomGenerable().generator();
long edgesToGenerate = blockInfo.getElementCount();
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/SingletonEdgeGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/SingletonEdgeGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/SingletonEdgeGraph.java
index e35b517..2eef7ae 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/SingletonEdgeGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/SingletonEdgeGraph.java
@@ -58,16 +58,16 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
@Override
- public Graph<LongValue,NullValue,NullValue> generate() {
+ public Graph<LongValue, NullValue, NullValue> generate() {
// Vertices
long vertexCount = 2 * this.vertexPairCount;
- DataSet<Vertex<LongValue,NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
+ DataSet<Vertex<LongValue, NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
// Edges
LongValueSequenceIterator iterator = new LongValueSequenceIterator(0, vertexCount - 1);
- DataSet<Edge<LongValue,NullValue>> edges = env
+ DataSet<Edge<LongValue, NullValue>> edges = env
.fromParallelCollection(iterator, LongValue.class)
.setParallelism(parallelism)
.name("Edge iterators")
@@ -81,16 +81,16 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
@ForwardedFields("*->f0")
private static class LinkVertexToSingletonNeighbor
- implements MapFunction<LongValue, Edge<LongValue,NullValue>> {
+ implements MapFunction<LongValue, Edge<LongValue, NullValue>> {
private LongValue source = new LongValue();
private LongValue target = new LongValue();
- private Edge<LongValue,NullValue> edge = new Edge<>(source, target, NullValue.getInstance());
+ private Edge<LongValue, NullValue> edge = new Edge<>(source, target, NullValue.getInstance());
@Override
- public Edge<LongValue,NullValue> map(LongValue value) throws Exception {
+ public Edge<LongValue, NullValue> map(LongValue value) throws Exception {
long val = value.getValue();
source.setValue(val);
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/StarGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/StarGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/StarGraph.java
index cb99f30..a47ae4d 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/StarGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/StarGraph.java
@@ -58,14 +58,14 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
@Override
- public Graph<LongValue,NullValue,NullValue> generate() {
+ public Graph<LongValue, NullValue, NullValue> generate() {
// Vertices
- DataSet<Vertex<LongValue,NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
+ DataSet<Vertex<LongValue, NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);
// Edges
LongValueSequenceIterator iterator = new LongValueSequenceIterator(1, this.vertexCount - 1);
- DataSet<Edge<LongValue,NullValue>> edges = env
+ DataSet<Edge<LongValue, NullValue>> edges = env
.fromParallelCollection(iterator, LongValue.class)
.setParallelism(parallelism)
.name("Edge iterators")
@@ -79,16 +79,16 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
@ForwardedFields("*->f0")
public class LinkVertexToCenter
- implements FlatMapFunction<LongValue, Edge<LongValue,NullValue>> {
+ implements FlatMapFunction<LongValue, Edge<LongValue, NullValue>> {
private LongValue center = new LongValue(0);
- private Edge<LongValue,NullValue> center_to_leaf = new Edge<>(center, null, NullValue.getInstance());
+ private Edge<LongValue, NullValue> center_to_leaf = new Edge<>(center, null, NullValue.getInstance());
- private Edge<LongValue,NullValue> leaf_to_center = new Edge<>(null, center, NullValue.getInstance());
+ private Edge<LongValue, NullValue> leaf_to_center = new Edge<>(null, center, NullValue.getInstance());
@Override
- public void flatMap(LongValue leaf, Collector<Edge<LongValue,NullValue>> out)
+ public void flatMap(LongValue leaf, Collector<Edge<LongValue, NullValue>> out)
throws Exception {
center_to_leaf.f1 = leaf;
out.collect(center_to_leaf);
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/TriangleEnumerator.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/TriangleEnumerator.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/TriangleEnumerator.java
index dabeb06..6296618 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/TriangleEnumerator.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/TriangleEnumerator.java
@@ -60,10 +60,10 @@ import java.util.List;
* grouping on edges on the vertex with the smaller degree.
*/
public class TriangleEnumerator<K extends Comparable<K>, VV, EV> implements
- GraphAlgorithm<K, VV, EV, DataSet<Tuple3<K,K,K>>> {
+ GraphAlgorithm<K, VV, EV, DataSet<Tuple3<K, K, K>>> {
@Override
- public DataSet<Tuple3<K,K,K>> run(Graph<K, VV, EV> input) throws Exception {
+ public DataSet<Tuple3<K, K, K>> run(Graph<K, VV, EV> input) throws Exception {
DataSet<Edge<K, EV>> edges = input.getEdges();
@@ -77,7 +77,7 @@ public class TriangleEnumerator<K extends Comparable<K>, VV, EV> implements
// project edges by vertex id
DataSet<Edge<K, NullValue>> edgesById = edgesByDegree.map(new EdgeByIdProjector<K>());
- DataSet<Tuple3<K,K,K>> triangles = edgesByDegree
+ DataSet<Tuple3<K, K, K>> triangles = edgesByDegree
// build triads
.groupBy(EdgeWithDegrees.V1).sortGroup(EdgeWithDegrees.V2, Order.ASCENDING)
.reduceGroup(new TriadBuilder<K>())
@@ -268,10 +268,10 @@ public class TriangleEnumerator<K extends Comparable<K>, VV, EV> implements
* Filters triads (three vertices connected by two edges) without a closing third edge.
*/
@SuppressWarnings("serial")
- private static final class TriadFilter<K> implements JoinFunction<Triad<K>, Edge<K,NullValue>, Tuple3<K,K,K>> {
+ private static final class TriadFilter<K> implements JoinFunction<Triad<K>, Edge<K, NullValue>, Tuple3<K, K, K>> {
@Override
- public Tuple3<K,K,K> join(Triad<K> triad, Edge<K, NullValue> edge) throws Exception {
+ public Tuple3<K, K, K> join(Triad<K> triad, Edge<K, NullValue> edge) throws Exception {
return new Tuple3<>(triad.getFirstVertex(), triad.getSecondVertex(), triad.getThirdVertex());
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/LocalClusteringCoefficient.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/LocalClusteringCoefficient.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/LocalClusteringCoefficient.java
index 93fb678..cad36b3 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/LocalClusteringCoefficient.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/LocalClusteringCoefficient.java
@@ -139,7 +139,7 @@ extends GraphAlgorithmWrappingDataSet<K, VV, EV, Result<K>> {
throws Exception {
// u, v, w, bitmask
DataSet<TriangleListing.Result<K>> triangles = input
- .run(new TriangleListing<K,VV,EV>()
+ .run(new TriangleListing<K, VV, EV>()
.setLittleParallelism(littleParallelism));
// u, edge count
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/undirected/LocalClusteringCoefficient.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/undirected/LocalClusteringCoefficient.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/undirected/LocalClusteringCoefficient.java
index b22a0ce..99e3db9 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/undirected/LocalClusteringCoefficient.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/undirected/LocalClusteringCoefficient.java
@@ -138,8 +138,8 @@ extends GraphAlgorithmWrappingDataSet<K, VV, EV, Result<K>> {
public DataSet<Result<K>> runInternal(Graph<K, VV, EV> input)
throws Exception {
// u, v, w
- DataSet<Tuple3<K,K,K>> triangles = input
- .run(new TriangleListing<K,VV,EV>()
+ DataSet<Tuple3<K, K, K>> triangles = input
+ .run(new TriangleListing<K, VV, EV>()
.setLittleParallelism(littleParallelism));
// u, 1
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java
index 5b2502e..7e8ebd7 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java
@@ -170,7 +170,7 @@ public class VertexCentricIteration<K, VV, EV, Message>
DataSet<Tuple2<K, Either<NullValue, Message>>> initialWorkSet = initialVertices.map(
new InitializeWorkSet<K, VV, Message>()).returns(workSetTypeInfo);
- final DeltaIteration<Vertex<K, VV>, Tuple2<K, Either<NullValue, Message>>> iteration =
+ final DeltaIteration<Vertex<K, VV>, Tuple2<K, Either<NullValue, Message>>> iteration =
initialVertices.iterateDelta(initialWorkSet, this.maximumNumberOfIterations, 0);
setUpIteration(iteration);
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java
index a378ab1..9f5585d 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java
@@ -569,7 +569,7 @@ public class ScatterGatherIteration<K, VV, Message, EV>
TypeInformation<Vertex<K, VV>> vertexTypes = initialVertices.getType();
- final DeltaIteration<Vertex<K, VV>, Vertex<K, VV>> iteration =
+ final DeltaIteration<Vertex<K, VV>, Vertex<K, VV>> iteration =
initialVertices.iterateDelta(initialVertices, this.maximumNumberOfIterations, 0);
setUpIteration(iteration);
@@ -635,7 +635,7 @@ public class ScatterGatherIteration<K, VV, Message, EV>
DataSet<Vertex<K, Tuple3<VV, LongValue, LongValue>>> verticesWithDegrees = initialVertices
.join(degrees).where(0).equalTo(0)
- .with(new FlatJoinFunction<Vertex<K,VV>, Tuple3<K, LongValue, LongValue>, Vertex<K, Tuple3<VV, LongValue, LongValue>>>() {
+ .with(new FlatJoinFunction<Vertex<K, VV>, Tuple3<K, LongValue, LongValue>, Vertex<K, Tuple3<VV, LongValue, LongValue>>>() {
@Override
public void join(Vertex<K, VV> vertex, Tuple3<K, LongValue, LongValue> degrees,
Collector<Vertex<K, Tuple3<VV, LongValue, LongValue>>> out) throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/GraphAlgorithmWrappingDataSet.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/GraphAlgorithmWrappingDataSet.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/GraphAlgorithmWrappingDataSet.java
index 7a4a0e6..11e7a64 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/GraphAlgorithmWrappingDataSet.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/GraphAlgorithmWrappingDataSet.java
@@ -52,7 +52,7 @@ implements GraphAlgorithm<K, VV, EV, DataSet<T>> {
private static Map<GraphAlgorithmWrappingDataSet, List<GraphAlgorithmWrappingDataSet>> cache =
Collections.synchronizedMap(new HashMap<GraphAlgorithmWrappingDataSet, List<GraphAlgorithmWrappingDataSet>>());
- private Graph<K,VV,EV> input;
+ private Graph<K, VV, EV> input;
private NoOpOperator<T> wrappingOperator;
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/AsmTestBase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/AsmTestBase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/AsmTestBase.java
index 8ef87a5..14c2da4 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/AsmTestBase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/AsmTestBase.java
@@ -38,24 +38,24 @@ public class AsmTestBase {
protected ExecutionEnvironment env;
// simple graph
- protected Graph<IntValue,NullValue,NullValue> directedSimpleGraph;
+ protected Graph<IntValue, NullValue, NullValue> directedSimpleGraph;
- protected Graph<IntValue,NullValue,NullValue> undirectedSimpleGraph;
+ protected Graph<IntValue, NullValue, NullValue> undirectedSimpleGraph;
// complete graph
protected final long completeGraphVertexCount = 47;
- protected Graph<LongValue,NullValue,NullValue> completeGraph;
+ protected Graph<LongValue, NullValue, NullValue> completeGraph;
// empty graph
protected final long emptyGraphVertexCount = 3;
- protected Graph<LongValue,NullValue,NullValue> emptyGraph;
+ protected Graph<LongValue, NullValue, NullValue> emptyGraph;
// RMat graph
- protected Graph<LongValue,NullValue,NullValue> directedRMatGraph;
+ protected Graph<LongValue, NullValue, NullValue> directedRMatGraph;
- protected Graph<LongValue,NullValue,NullValue> undirectedRMatGraph;
+ protected Graph<LongValue, NullValue, NullValue> undirectedRMatGraph;
@Before
public void setup()
@@ -73,7 +73,7 @@ public class AsmTestBase {
new Object[]{5, 3},
};
- List<Edge<IntValue,NullValue>> directedEdgeList = new LinkedList<>();
+ List<Edge<IntValue, NullValue>> directedEdgeList = new LinkedList<>();
for (Object[] edge : edges) {
directedEdgeList.add(new Edge<>(new IntValue((int) edge[0]), new IntValue((int) edge[1]), NullValue.getInstance()));
@@ -95,7 +95,7 @@ public class AsmTestBase {
long rmatVertexCount = 1L << 10;
long rmatEdgeCount = 16 * rmatVertexCount;
- Graph<LongValue,NullValue,NullValue> rmatGraph = new RMatGraph<>(env, new JDKRandomGeneratorFactory(), rmatVertexCount, rmatEdgeCount)
+ Graph<LongValue, NullValue, NullValue> rmatGraph = new RMatGraph<>(env, new JDKRandomGeneratorFactory(), rmatVertexCount, rmatEdgeCount)
.generate();
directedRMatGraph = rmatGraph
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/simple/directed/SimplifyTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/simple/directed/SimplifyTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/simple/directed/SimplifyTest.java
index a4b3946..709317c 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/simple/directed/SimplifyTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/simple/directed/SimplifyTest.java
@@ -32,7 +32,7 @@ import java.util.List;
public class SimplifyTest {
- protected Graph<IntValue,NullValue,NullValue> graph;
+ protected Graph<IntValue, NullValue, NullValue> graph;
@Before
public void setup() {
@@ -65,7 +65,7 @@ public class SimplifyTest {
"(0,2,(null))\n" +
"(1,0,(null))";
- Graph<IntValue,NullValue,NullValue> simpleGraph = graph
+ Graph<IntValue, NullValue, NullValue> simpleGraph = graph
.run(new Simplify<IntValue, NullValue, NullValue>());
TestBaseUtils.compareResultAsText(simpleGraph.getEdges().collect(), expectedResult);
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/simple/undirected/SimplifyTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/simple/undirected/SimplifyTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/simple/undirected/SimplifyTest.java
index 2ace2bd..d589000 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/simple/undirected/SimplifyTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/simple/undirected/SimplifyTest.java
@@ -32,7 +32,7 @@ import java.util.List;
public class SimplifyTest {
- protected Graph<IntValue,NullValue,NullValue> graph;
+ protected Graph<IntValue, NullValue, NullValue> graph;
@Before
public void setup() {
@@ -66,7 +66,7 @@ public class SimplifyTest {
"(1,0,(null))\n" +
"(2,0,(null))";
- Graph<IntValue,NullValue,NullValue> simpleGraph = graph
+ Graph<IntValue, NullValue, NullValue> simpleGraph = graph
.run(new Simplify<IntValue, NullValue, NullValue>(false));
TestBaseUtils.compareResultAsText(simpleGraph.getEdges().collect(), expectedResult);
@@ -79,7 +79,7 @@ public class SimplifyTest {
"(0,1,(null))\n" +
"(1,0,(null))";
- Graph<IntValue,NullValue,NullValue> simpleGraph = graph
+ Graph<IntValue, NullValue, NullValue> simpleGraph = graph
.run(new Simplify<IntValue, NullValue, NullValue>(true));
TestBaseUtils.compareResultAsText(simpleGraph.getEdges().collect(), expectedResult);
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/translate/TranslateTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/translate/TranslateTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/translate/TranslateTest.java
index ba6bd05..7d6e3ea 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/translate/TranslateTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/asm/translate/TranslateTest.java
@@ -86,7 +86,7 @@ public class TranslateTest {
@Test
public void testTranslateGraphIds()
throws Exception {
- Graph<StringValue,LongValue, LongValue> stringIdGraph = graph
+ Graph<StringValue, LongValue, LongValue> stringIdGraph = graph
.translateGraphIds(new LongValueToStringValue());
for (Vertex<StringValue, LongValue> vertex : stringIdGraph.getVertices().collect()) {
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/CompleteGraphTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/CompleteGraphTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/CompleteGraphTest.java
index 6c0e094..cb06da5 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/CompleteGraphTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/CompleteGraphTest.java
@@ -36,7 +36,7 @@ extends AbstractGraphTest {
throws Exception {
int vertexCount = 4;
- Graph<LongValue,NullValue,NullValue> graph = new CompleteGraph(env, vertexCount)
+ Graph<LongValue, NullValue, NullValue> graph = new CompleteGraph(env, vertexCount)
.generate();
String vertices = "0; 1; 2; 3";
@@ -50,7 +50,7 @@ extends AbstractGraphTest {
throws Exception {
int vertexCount = 10;
- Graph<LongValue,NullValue,NullValue> graph = new CompleteGraph(env, vertexCount)
+ Graph<LongValue, NullValue, NullValue> graph = new CompleteGraph(env, vertexCount)
.generate();
assertEquals(vertexCount, graph.numberOfVertices());
@@ -72,12 +72,12 @@ extends AbstractGraphTest {
throws Exception {
int parallelism = 2;
- Graph<LongValue,NullValue,NullValue> graph = new CompleteGraph(env, 10)
+ Graph<LongValue, NullValue, NullValue> graph = new CompleteGraph(env, 10)
.setParallelism(parallelism)
.generate();
- graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue,NullValue>>());
- graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue,NullValue>>());
+ graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue, NullValue>>());
+ graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue, NullValue>>());
TestUtils.verifyParallelism(env, parallelism);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/CycleGraphTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/CycleGraphTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/CycleGraphTest.java
index ec36aa7..be56f56 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/CycleGraphTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/CycleGraphTest.java
@@ -34,7 +34,7 @@ extends AbstractGraphTest {
@Test
public void testGraph()
throws Exception {
- Graph<LongValue,NullValue,NullValue> graph = new CycleGraph(env, 10)
+ Graph<LongValue, NullValue, NullValue> graph = new CycleGraph(env, 10)
.generate();
String vertices = "0; 1; 2; 3; 4; 5; 6; 7; 8; 9";
@@ -49,7 +49,7 @@ extends AbstractGraphTest {
throws Exception {
int vertexCount = 100;
- Graph<LongValue,NullValue,NullValue> graph = new CycleGraph(env, vertexCount)
+ Graph<LongValue, NullValue, NullValue> graph = new CycleGraph(env, vertexCount)
.generate();
assertEquals(vertexCount, graph.numberOfVertices());
@@ -71,12 +71,12 @@ extends AbstractGraphTest {
throws Exception {
int parallelism = 2;
- Graph<LongValue,NullValue,NullValue> graph = new CycleGraph(env, 100)
+ Graph<LongValue, NullValue, NullValue> graph = new CycleGraph(env, 100)
.setParallelism(parallelism)
.generate();
- graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue,NullValue>>());
- graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue,NullValue>>());
+ graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue, NullValue>>());
+ graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue, NullValue>>());
TestUtils.verifyParallelism(env, parallelism);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/EmptyGraphTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/EmptyGraphTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/EmptyGraphTest.java
index d4a524f..c039607 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/EmptyGraphTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/EmptyGraphTest.java
@@ -34,7 +34,7 @@ extends AbstractGraphTest {
@Test
public void testGraph()
throws Exception {
- Graph<LongValue,NullValue,NullValue> graph = new EmptyGraph(env, 10)
+ Graph<LongValue, NullValue, NullValue> graph = new EmptyGraph(env, 10)
.generate();
String vertices = "0; 1; 2; 3; 4; 5; 6; 7; 8; 9";
@@ -48,7 +48,7 @@ extends AbstractGraphTest {
throws Exception {
int vertexCount = 100;
- Graph<LongValue,NullValue,NullValue> graph = new EmptyGraph(env, vertexCount)
+ Graph<LongValue, NullValue, NullValue> graph = new EmptyGraph(env, vertexCount)
.generate();
assertEquals(vertexCount, graph.numberOfVertices());
@@ -66,12 +66,12 @@ extends AbstractGraphTest {
throws Exception {
int parallelism = 2;
- Graph<LongValue,NullValue,NullValue> graph = new EmptyGraph(env, 100)
+ Graph<LongValue, NullValue, NullValue> graph = new EmptyGraph(env, 100)
.setParallelism(parallelism)
.generate();
- graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue,NullValue>>());
- graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue,NullValue>>());
+ graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue, NullValue>>());
+ graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue, NullValue>>());
TestUtils.verifyParallelism(env, parallelism);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/GridGraphTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/GridGraphTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/GridGraphTest.java
index 9606d1a..6a01a34 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/GridGraphTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/GridGraphTest.java
@@ -79,14 +79,14 @@ extends AbstractGraphTest {
throws Exception {
int parallelism = 2;
- Graph<LongValue,NullValue,NullValue> graph = new GridGraph(env)
+ Graph<LongValue, NullValue, NullValue> graph = new GridGraph(env)
.addDimension(3, false)
.addDimension(5, false)
.setParallelism(parallelism)
.generate();
- graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue,NullValue>>());
- graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue,NullValue>>());
+ graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue, NullValue>>());
+ graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue, NullValue>>());
TestUtils.verifyParallelism(env, parallelism);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/HypercubeGraphTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/HypercubeGraphTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/HypercubeGraphTest.java
index d723ecb..49b0ba7 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/HypercubeGraphTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/HypercubeGraphTest.java
@@ -73,12 +73,12 @@ extends AbstractGraphTest {
throws Exception {
int parallelism = 2;
- Graph<LongValue,NullValue,NullValue> graph = new HypercubeGraph(env, 4)
+ Graph<LongValue, NullValue, NullValue> graph = new HypercubeGraph(env, 4)
.setParallelism(parallelism)
.generate();
- graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue,NullValue>>());
- graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue,NullValue>>());
+ graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue, NullValue>>());
+ graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue, NullValue>>());
TestUtils.verifyParallelism(env, parallelism);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/PathGraphTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/PathGraphTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/PathGraphTest.java
index 3c3ce8c..b5c7cd3 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/PathGraphTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/PathGraphTest.java
@@ -34,7 +34,7 @@ extends AbstractGraphTest {
@Test
public void testGraph()
throws Exception {
- Graph<LongValue,NullValue,NullValue> graph = new PathGraph(env, 10)
+ Graph<LongValue, NullValue, NullValue> graph = new PathGraph(env, 10)
.generate();
String vertices = "0; 1; 2; 3; 4; 5; 6; 7; 8; 9";
@@ -49,7 +49,7 @@ extends AbstractGraphTest {
throws Exception {
int vertexCount = 100;
- Graph<LongValue,NullValue,NullValue> graph = new PathGraph(env, vertexCount)
+ Graph<LongValue, NullValue, NullValue> graph = new PathGraph(env, vertexCount)
.generate();
assertEquals(vertexCount, graph.numberOfVertices());
@@ -71,12 +71,12 @@ extends AbstractGraphTest {
throws Exception {
int parallelism = 2;
- Graph<LongValue,NullValue,NullValue> graph = new PathGraph(env, 100)
+ Graph<LongValue, NullValue, NullValue> graph = new PathGraph(env, 100)
.setParallelism(parallelism)
.generate();
- graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue,NullValue>>());
- graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue,NullValue>>());
+ graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue, NullValue>>());
+ graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue, NullValue>>());
TestUtils.verifyParallelism(env, parallelism);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/RMatGraphTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/RMatGraphTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/RMatGraphTest.java
index a06c63f..2cda69a 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/RMatGraphTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/RMatGraphTest.java
@@ -44,7 +44,7 @@ extends AbstractGraphTest {
RandomGenerableFactory<JDKRandomGenerator> rnd = new JDKRandomGeneratorFactory();
- Graph<LongValue,NullValue,NullValue> graph = new RMatGraph<>(env, rnd, vertexCount, edgeCount)
+ Graph<LongValue, NullValue, NullValue> graph = new RMatGraph<>(env, rnd, vertexCount, edgeCount)
.generate();
assertTrue(vertexCount >= graph.numberOfVertices());
@@ -58,12 +58,12 @@ extends AbstractGraphTest {
RandomGenerableFactory<JDKRandomGenerator> rnd = new JDKRandomGeneratorFactory();
- Graph<LongValue,NullValue,NullValue> graph = new RMatGraph<>(env, rnd, 100, 1000)
+ Graph<LongValue, NullValue, NullValue> graph = new RMatGraph<>(env, rnd, 100, 1000)
.setParallelism(parallelism)
.generate();
- graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue,NullValue>>());
- graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue,NullValue>>());
+ graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue, NullValue>>());
+ graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue, NullValue>>());
TestUtils.verifyParallelism(env, parallelism);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/SingletonEdgeGraphTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/SingletonEdgeGraphTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/SingletonEdgeGraphTest.java
index 44a4d99..5e9a79a 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/SingletonEdgeGraphTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/SingletonEdgeGraphTest.java
@@ -36,7 +36,7 @@ extends AbstractGraphTest {
throws Exception {
int vertexPairCount = 5;
- Graph<LongValue,NullValue,NullValue> graph = new SingletonEdgeGraph(env, vertexPairCount)
+ Graph<LongValue, NullValue, NullValue> graph = new SingletonEdgeGraph(env, vertexPairCount)
.generate();
String vertices = "0; 1; 2; 3; 4; 5; 6; 7; 8; 9";
@@ -50,7 +50,7 @@ extends AbstractGraphTest {
throws Exception {
int vertexPairCount = 10;
- Graph<LongValue,NullValue,NullValue> graph = new SingletonEdgeGraph(env, vertexPairCount)
+ Graph<LongValue, NullValue, NullValue> graph = new SingletonEdgeGraph(env, vertexPairCount)
.generate();
assertEquals(2 * vertexPairCount, graph.numberOfVertices());
@@ -72,12 +72,12 @@ extends AbstractGraphTest {
throws Exception {
int parallelism = 2;
- Graph<LongValue,NullValue,NullValue> graph = new SingletonEdgeGraph(env, 10)
+ Graph<LongValue, NullValue, NullValue> graph = new SingletonEdgeGraph(env, 10)
.setParallelism(parallelism)
.generate();
- graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue,NullValue>>());
- graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue,NullValue>>());
+ graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue, NullValue>>());
+ graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue, NullValue>>());
TestUtils.verifyParallelism(env, parallelism);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/StarGraphTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/StarGraphTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/StarGraphTest.java
index c656cfb..4ccb804 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/StarGraphTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/StarGraphTest.java
@@ -36,7 +36,7 @@ extends AbstractGraphTest {
throws Exception {
int vertexCount = 10;
- Graph<LongValue,NullValue,NullValue> graph = new StarGraph(env, vertexCount)
+ Graph<LongValue, NullValue, NullValue> graph = new StarGraph(env, vertexCount)
.generate();
String vertices = "0; 1; 2; 3; 4; 5; 6; 7; 8; 9";
@@ -51,7 +51,7 @@ extends AbstractGraphTest {
throws Exception {
int vertexCount = 100;
- Graph<LongValue,NullValue,NullValue> graph = new StarGraph(env, vertexCount)
+ Graph<LongValue, NullValue, NullValue> graph = new StarGraph(env, vertexCount)
.generate();
assertEquals(vertexCount, graph.numberOfVertices());
@@ -73,12 +73,12 @@ extends AbstractGraphTest {
throws Exception {
int parallelism = 2;
- Graph<LongValue,NullValue,NullValue> graph = new StarGraph(env, 100)
+ Graph<LongValue, NullValue, NullValue> graph = new StarGraph(env, 100)
.setParallelism(parallelism)
.generate();
- graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue,NullValue>>());
- graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue,NullValue>>());
+ graph.getVertices().output(new DiscardingOutputFormat<Vertex<LongValue, NullValue>>());
+ graph.getEdges().output(new DiscardingOutputFormat<Edge<LongValue, NullValue>>());
TestUtils.verifyParallelism(env, parallelism);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/TestUtils.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/TestUtils.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/TestUtils.java
index a302a30..2cf9eac 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/TestUtils.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/generator/TestUtils.java
@@ -48,7 +48,7 @@ public final class TestUtils {
* @param <EV> the value type for edges
* @throws Exception
*/
- public static <K,VV,EV> void compareGraph(Graph<K,VV,EV> graph, String expectedVertices, String expectedEdges)
+ public static <K, VV, EV> void compareGraph(Graph<K, VV, EV> graph, String expectedVertices, String expectedEdges)
throws Exception {
compareVertices(graph, expectedVertices);
compareEdges(graph, expectedEdges);
@@ -63,7 +63,7 @@ public final class TestUtils {
resultVertices.add(vertex.f0.toString());
}
- TestBaseUtils.compareResultAsText(resultVertices, expectedVertices.replaceAll("\\s","").replace(";", "\n"));
+ TestBaseUtils.compareResultAsText(resultVertices, expectedVertices.replaceAll("\\s", "").replace(";", "\n"));
}
}
@@ -76,7 +76,7 @@ public final class TestUtils {
resultEdges.add(edge.f0.toString() + "," + edge.f1.toString());
}
- TestBaseUtils.compareResultAsText(resultEdges, expectedEdges.replaceAll("\\s","").replace(";", "\n"));
+ TestBaseUtils.compareResultAsText(resultEdges, expectedEdges.replaceAll("\\s", "").replace(";", "\n"));
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/library/link_analysis/HITSTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/library/link_analysis/HITSTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/library/link_analysis/HITSTest.java
index 1551d84..679bf4f 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/library/link_analysis/HITSTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/library/link_analysis/HITSTest.java
@@ -46,8 +46,8 @@ extends AsmTestBase {
List<Tuple2<Double, Double>> expectedResults = new ArrayList<>();
expectedResults.add(Tuple2.of(0.5446287864731747, 0.0));
expectedResults.add(Tuple2.of(0.0, 0.8363240238999012));
- expectedResults.add(Tuple2.of(0.6072453524686667,0.26848532437604833));
- expectedResults.add(Tuple2.of(0.5446287864731747,0.39546603929699625));
+ expectedResults.add(Tuple2.of(0.6072453524686667, 0.26848532437604833));
+ expectedResults.add(Tuple2.of(0.5446287864731747, 0.39546603929699625));
expectedResults.add(Tuple2.of(0.0, 0.26848532437604833));
expectedResults.add(Tuple2.of(0.194966796646811, 0.0));
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/pregel/PregelCompilerTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/pregel/PregelCompilerTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/pregel/PregelCompilerTest.java
index 04f0ca4..fb21c14 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/pregel/PregelCompilerTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/pregel/PregelCompilerTest.java
@@ -18,31 +18,31 @@
package org.apache.flink.graph.pregel;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import org.apache.flink.api.common.Plan;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.operators.util.FieldList;
-import org.apache.flink.api.java.io.DiscardingOutputFormat;
-import org.apache.flink.api.java.tuple.Tuple2;
-import org.apache.flink.optimizer.util.CompilerTestBase;
-import org.junit.Test;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
+import org.apache.flink.api.java.io.DiscardingOutputFormat;
+import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.graph.Edge;
import org.apache.flink.graph.Graph;
import org.apache.flink.graph.Vertex;
+import org.apache.flink.graph.utils.Tuple2ToVertexMap;
import org.apache.flink.optimizer.plan.DualInputPlanNode;
import org.apache.flink.optimizer.plan.OptimizedPlan;
import org.apache.flink.optimizer.plan.PlanNode;
import org.apache.flink.optimizer.plan.SingleInputPlanNode;
import org.apache.flink.optimizer.plan.SinkPlanNode;
import org.apache.flink.optimizer.plan.WorksetIterationPlanNode;
+import org.apache.flink.optimizer.util.CompilerTestBase;
import org.apache.flink.runtime.operators.shipping.ShipStrategyType;
import org.apache.flink.types.NullValue;
-import org.apache.flink.graph.utils.Tuple2ToVertexMap;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
public class PregelCompilerTest extends CompilerTestBase {
@@ -62,7 +62,7 @@ public class PregelCompilerTest extends CompilerTestBase {
.map(new Tuple2ToVertexMap<Long, Long>());
DataSet<Edge<Long, NullValue>> edges = env.fromElements(new Tuple2<>(1L, 2L))
- .map(new MapFunction<Tuple2<Long,Long>, Edge<Long, NullValue>>() {
+ .map(new MapFunction<Tuple2<Long, Long>, Edge<Long, NullValue>>() {
public Edge<Long, NullValue> map(Tuple2<Long, Long> edge) {
return new Edge<>(edge.f0, edge.f1, NullValue.getInstance());
@@ -136,7 +136,7 @@ public class PregelCompilerTest extends CompilerTestBase {
.map(new Tuple2ToVertexMap<Long, Long>());
DataSet<Edge<Long, NullValue>> edges = env.fromElements(new Tuple2<>(1L, 2L))
- .map(new MapFunction<Tuple2<Long,Long>, Edge<Long, NullValue>>() {
+ .map(new MapFunction<Tuple2<Long, Long>, Edge<Long, NullValue>>() {
public Edge<Long, NullValue> map(Tuple2<Long, Long> edge) {
return new Edge<>(edge.f0, edge.f1, NullValue.getInstance());
@@ -210,7 +210,7 @@ public class PregelCompilerTest extends CompilerTestBase {
.map(new Tuple2ToVertexMap<Long, Long>());
DataSet<Edge<Long, NullValue>> edges = env.fromElements(new Tuple2<>(1L, 2L))
- .map(new MapFunction<Tuple2<Long,Long>, Edge<Long, NullValue>>() {
+ .map(new MapFunction<Tuple2<Long, Long>, Edge<Long, NullValue>>() {
public Edge<Long, NullValue> map(Tuple2<Long, Long> edge) {
return new Edge<>(edge.f0, edge.f1, NullValue.getInstance());
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/pregel/PregelTranslationTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/pregel/PregelTranslationTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/pregel/PregelTranslationTest.java
index 8f9552f..3bf2e32 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/pregel/PregelTranslationTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/pregel/PregelTranslationTest.java
@@ -19,26 +19,26 @@
package org.apache.flink.graph.pregel;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.junit.Test;
import org.apache.flink.api.common.aggregators.LongSumAggregator;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.DataSet;
+import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.io.DiscardingOutputFormat;
import org.apache.flink.api.java.operators.DeltaIteration;
import org.apache.flink.api.java.operators.DeltaIterationResultSet;
import org.apache.flink.api.java.operators.SingleInputUdfOperator;
-import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.TwoInputUdfOperator;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.graph.Graph;
import org.apache.flink.graph.Vertex;
import org.apache.flink.types.NullValue;
+import org.junit.Test;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
@SuppressWarnings("serial")
public class PregelTranslationTest {
@@ -71,7 +71,7 @@ public class PregelTranslationTest {
DataSet<Tuple2<String, String>> edges = env.fromElements(new Tuple2<>("a", "c"));
Graph<String, Double, NullValue> graph = Graph.fromTupleDataSet(initialVertices,
- edges.map(new MapFunction<Tuple2<String,String>, Tuple3<String, String, NullValue>>() {
+ edges.map(new MapFunction<Tuple2<String, String>, Tuple3<String, String, NullValue>>() {
public Tuple3<String, String, NullValue> map(
Tuple2<String, String> edge) {
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/spargel/SpargelCompilerTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/spargel/SpargelCompilerTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/spargel/SpargelCompilerTest.java
index 14c2fb4..676e0cd 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/spargel/SpargelCompilerTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/spargel/SpargelCompilerTest.java
@@ -18,33 +18,33 @@
package org.apache.flink.graph.spargel;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import org.apache.flink.api.common.Plan;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.operators.util.FieldList;
import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
-import org.apache.flink.api.java.io.DiscardingOutputFormat;
-import org.apache.flink.api.java.tuple.Tuple2;
-import org.apache.flink.optimizer.util.CompilerTestBase;
-import org.junit.Test;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
+import org.apache.flink.api.java.io.DiscardingOutputFormat;
+import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.graph.Edge;
import org.apache.flink.graph.Graph;
import org.apache.flink.graph.Vertex;
+import org.apache.flink.graph.library.ConnectedComponents;
+import org.apache.flink.graph.utils.Tuple2ToVertexMap;
import org.apache.flink.optimizer.plan.DualInputPlanNode;
import org.apache.flink.optimizer.plan.OptimizedPlan;
import org.apache.flink.optimizer.plan.PlanNode;
import org.apache.flink.optimizer.plan.SinkPlanNode;
import org.apache.flink.optimizer.plan.WorksetIterationPlanNode;
+import org.apache.flink.optimizer.util.CompilerTestBase;
import org.apache.flink.runtime.operators.shipping.ShipStrategyType;
import org.apache.flink.runtime.operators.util.LocalStrategy;
import org.apache.flink.types.NullValue;
-import org.apache.flink.graph.library.ConnectedComponents;
-import org.apache.flink.graph.utils.Tuple2ToVertexMap;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
public class SpargelCompilerTest extends CompilerTestBase {
@@ -65,7 +65,7 @@ public class SpargelCompilerTest extends CompilerTestBase {
.map(new Tuple2ToVertexMap<Long, Long>());
DataSet<Edge<Long, NullValue>> edges = env.fromElements(new Tuple2<>(1L, 2L))
- .map(new MapFunction<Tuple2<Long,Long>, Edge<Long, NullValue>>() {
+ .map(new MapFunction<Tuple2<Long, Long>, Edge<Long, NullValue>>() {
public Edge<Long, NullValue> map(Tuple2<Long, Long> edge) {
return new Edge<>(edge.f0, edge.f1, NullValue.getInstance());
@@ -147,7 +147,7 @@ public class SpargelCompilerTest extends CompilerTestBase {
.map(new Tuple2ToVertexMap<Long, Long>());
DataSet<Edge<Long, NullValue>> edges = env.fromElements(new Tuple2<>(1L, 2L))
- .map(new MapFunction<Tuple2<Long,Long>, Edge<Long, NullValue>>() {
+ .map(new MapFunction<Tuple2<Long, Long>, Edge<Long, NullValue>>() {
public Edge<Long, NullValue> map(Tuple2<Long, Long> edge) {
return new Edge<>(edge.f0, edge.f1, NullValue.getInstance());
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/spargel/SpargelTranslationTest.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/spargel/SpargelTranslationTest.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/spargel/SpargelTranslationTest.java
index 2c7e093..47b785d 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/spargel/SpargelTranslationTest.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/spargel/SpargelTranslationTest.java
@@ -72,7 +72,7 @@ public class SpargelTranslationTest {
DataSet<Tuple2<String, String>> edges = env.fromElements(new Tuple2<>("a", "c"));
Graph<String, Double, NullValue> graph = Graph.fromTupleDataSet(initialVertices,
- edges.map(new MapFunction<Tuple2<String,String>, Tuple3<String, String, NullValue>>() {
+ edges.map(new MapFunction<Tuple2<String, String>, Tuple3<String, String, NullValue>>() {
public Tuple3<String, String, NullValue> map(
Tuple2<String, String> edge) {
@@ -158,7 +158,7 @@ public class SpargelTranslationTest {
DataSet<Tuple2<String, String>> edges = env.fromElements(new Tuple2<>("a", "c"));
Graph<String, Double, NullValue> graph = Graph.fromTupleDataSet(initialVertices,
- edges.map(new MapFunction<Tuple2<String,String>, Tuple3<String, String, NullValue>>() {
+ edges.map(new MapFunction<Tuple2<String, String>, Tuple3<String, String, NullValue>>() {
public Tuple3<String, String, NullValue> map(
Tuple2<String, String> edge) {
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/ScatterGatherConfigurationITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/ScatterGatherConfigurationITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/ScatterGatherConfigurationITCase.java
index 2213700..9100883 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/ScatterGatherConfigurationITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/ScatterGatherConfigurationITCase.java
@@ -73,8 +73,8 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.runScatterGatherIteration(
new MessageFunction(), new UpdateFunction(), 10, parameters);
- DataSet<Vertex<Long,Long>> data = res.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = res.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,11\n" +
"2,11\n" +
@@ -109,7 +109,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
Assert.assertEquals(true, iteration.getIterationConfiguration().isSolutionSetUnmanagedMemory());
DataSet<Vertex<Long, Long>> data = TestGraphUtils.getLongLongVertexData(env).runOperation(iteration);
- List<Vertex<Long,Long>> result= data.collect();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,11\n" +
"2,12\n" +
[4/6] flink git commit: [hotfix] [gelly] Indent Java with tabs not
spaces
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
index 84d7722..b26bb43 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
@@ -41,11 +41,11 @@ import java.util.Objects;
@RunWith(Parameterized.class)
public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
- public ReduceOnEdgesMethodsITCase(TestExecutionMode mode){
+ public ReduceOnEdgesMethodsITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
+ private String expectedResult;
@Test
public void testLowestWeightOutNeighbor() throws Exception {
@@ -54,20 +54,19 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
* for each vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
- graph.groupReduceOnEdges(new SelectMinWeightNeighbor(), EdgeDirection.OUT);
+ DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
+ graph.groupReduceOnEdges(new SelectMinWeightNeighbor(), EdgeDirection.OUT);
List<Tuple2<Long, Long>> result = verticesWithLowestOutNeighbor.collect();
-
expectedResult = "1,2\n" +
- "2,3\n" +
- "3,4\n" +
- "4,5\n" +
- "5,1\n";
-
+ "2,3\n" +
+ "3,4\n" +
+ "4,5\n" +
+ "5,1\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -78,19 +77,19 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
* for each vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
- graph.groupReduceOnEdges(new SelectMinWeightInNeighbor(), EdgeDirection.IN);
+ DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
+ graph.groupReduceOnEdges(new SelectMinWeightInNeighbor(), EdgeDirection.IN);
List<Tuple2<Long, Long>> result = verticesWithLowestOutNeighbor.collect();
expectedResult = "1,5\n" +
- "2,1\n" +
- "3,1\n" +
- "4,3\n" +
- "5,3\n";
-
+ "2,1\n" +
+ "3,1\n" +
+ "4,3\n" +
+ "5,3\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -101,20 +100,20 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithAllOutNeighbors =
- graph.groupReduceOnEdges(new SelectOutNeighbors(), EdgeDirection.OUT);
+ graph.groupReduceOnEdges(new SelectOutNeighbors(), EdgeDirection.OUT);
List<Tuple2<Long, Long>> result = verticesWithAllOutNeighbors.collect();
expectedResult = "1,2\n" +
- "1,3\n" +
- "2,3\n" +
- "3,4\n" +
- "3,5\n" +
- "4,5\n" +
- "5,1";
-
+ "1,3\n" +
+ "2,3\n" +
+ "3,4\n" +
+ "3,5\n" +
+ "4,5\n" +
+ "5,1";
+
compareResultAsTuples(result, expectedResult);
}
@@ -125,19 +124,19 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithAllOutNeighbors =
- graph.groupReduceOnEdges(new SelectOutNeighborsExcludeFive(), EdgeDirection.OUT);
+ graph.groupReduceOnEdges(new SelectOutNeighborsExcludeFive(), EdgeDirection.OUT);
List<Tuple2<Long, Long>> result = verticesWithAllOutNeighbors.collect();
expectedResult = "1,2\n" +
- "1,3\n" +
- "2,3\n" +
- "3,4\n" +
- "3,5\n" +
- "4,5";
-
+ "1,3\n" +
+ "2,3\n" +
+ "3,4\n" +
+ "3,5\n" +
+ "4,5";
+
compareResultAsTuples(result, expectedResult);
}
@@ -148,17 +147,17 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithAllOutNeighbors =
- graph.groupReduceOnEdges(new SelectOutNeighborsValueGreaterThanTwo(), EdgeDirection.OUT);
+ graph.groupReduceOnEdges(new SelectOutNeighborsValueGreaterThanTwo(), EdgeDirection.OUT);
List<Tuple2<Long, Long>> result = verticesWithAllOutNeighbors.collect();
expectedResult = "3,4\n" +
- "3,5\n" +
- "4,5\n" +
- "5,1";
-
+ "3,5\n" +
+ "4,5\n" +
+ "5,1";
+
compareResultAsTuples(result, expectedResult);
}
@@ -169,20 +168,20 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithAllInNeighbors =
- graph.groupReduceOnEdges(new SelectInNeighbors(), EdgeDirection.IN);
+ graph.groupReduceOnEdges(new SelectInNeighbors(), EdgeDirection.IN);
List<Tuple2<Long, Long>> result = verticesWithAllInNeighbors.collect();
expectedResult = "1,5\n" +
- "2,1\n" +
- "3,1\n" +
- "3,2\n" +
- "4,3\n" +
- "5,3\n" +
- "5,4";
-
+ "2,1\n" +
+ "3,1\n" +
+ "3,2\n" +
+ "4,3\n" +
+ "5,3\n" +
+ "5,4";
+
compareResultAsTuples(result, expectedResult);
}
@@ -193,18 +192,18 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithAllInNeighbors =
- graph.groupReduceOnEdges(new SelectInNeighborsExceptFive(), EdgeDirection.IN);
+ graph.groupReduceOnEdges(new SelectInNeighborsExceptFive(), EdgeDirection.IN);
List<Tuple2<Long, Long>> result = verticesWithAllInNeighbors.collect();
expectedResult = "1,5\n" +
- "2,1\n" +
- "3,1\n" +
- "3,2\n" +
- "4,3";
-
+ "2,1\n" +
+ "3,1\n" +
+ "3,2\n" +
+ "4,3";
+
compareResultAsTuples(result, expectedResult);
}
@@ -215,18 +214,18 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithAllInNeighbors =
- graph.groupReduceOnEdges(new SelectInNeighborsValueGreaterThanTwo(), EdgeDirection.IN);
+ graph.groupReduceOnEdges(new SelectInNeighborsValueGreaterThanTwo(), EdgeDirection.IN);
List<Tuple2<Long, Long>> result = verticesWithAllInNeighbors.collect();
expectedResult = "3,1\n" +
- "3,2\n" +
- "4,3\n" +
- "5,3\n" +
- "5,4";
-
+ "3,2\n" +
+ "4,3\n" +
+ "5,3\n" +
+ "5,4";
+
compareResultAsTuples(result, expectedResult);
}
@@ -237,27 +236,27 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithAllNeighbors =
- graph.groupReduceOnEdges(new SelectNeighbors(), EdgeDirection.ALL);
+ graph.groupReduceOnEdges(new SelectNeighbors(), EdgeDirection.ALL);
List<Tuple2<Long, Long>> result = verticesWithAllNeighbors.collect();
expectedResult = "1,2\n" +
- "1,3\n" +
- "1,5\n" +
- "2,1\n" +
- "2,3\n" +
- "3,1\n" +
- "3,2\n" +
- "3,4\n" +
- "3,5\n" +
- "4,3\n" +
- "4,5\n" +
- "5,1\n" +
- "5,3\n" +
- "5,4";
-
+ "1,3\n" +
+ "1,5\n" +
+ "2,1\n" +
+ "2,3\n" +
+ "3,1\n" +
+ "3,2\n" +
+ "3,4\n" +
+ "3,5\n" +
+ "4,3\n" +
+ "4,5\n" +
+ "5,1\n" +
+ "5,3\n" +
+ "5,4";
+
compareResultAsTuples(result, expectedResult);
}
@@ -268,22 +267,22 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithAllNeighbors =
- graph.groupReduceOnEdges(new SelectNeighborsExceptFiveAndTwo(), EdgeDirection.ALL);
+ graph.groupReduceOnEdges(new SelectNeighborsExceptFiveAndTwo(), EdgeDirection.ALL);
List<Tuple2<Long, Long>> result = verticesWithAllNeighbors.collect();
expectedResult = "1,2\n" +
- "1,3\n" +
- "1,5\n" +
- "3,1\n" +
- "3,2\n" +
- "3,4\n" +
- "3,5\n" +
- "4,3\n" +
- "4,5";
-
+ "1,3\n" +
+ "1,5\n" +
+ "3,1\n" +
+ "3,2\n" +
+ "3,4\n" +
+ "3,5\n" +
+ "4,3\n" +
+ "4,5";
+
compareResultAsTuples(result, expectedResult);
}
@@ -294,16 +293,16 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithAllNeighbors =
- graph.groupReduceOnEdges(new SelectNeighborsValueGreaterThanFour(), EdgeDirection.ALL);
+ graph.groupReduceOnEdges(new SelectNeighborsValueGreaterThanFour(), EdgeDirection.ALL);
List<Tuple2<Long, Long>> result = verticesWithAllNeighbors.collect();
expectedResult = "5,1\n" +
- "5,3\n" +
- "5,4";
-
+ "5,3\n" +
+ "5,4";
+
compareResultAsTuples(result, expectedResult);
}
@@ -314,19 +313,19 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
* of a vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithMaxEdgeWeight =
- graph.groupReduceOnEdges(new SelectMaxWeightNeighbor(), EdgeDirection.ALL);
+ DataSet<Tuple2<Long, Long>> verticesWithMaxEdgeWeight =
+ graph.groupReduceOnEdges(new SelectMaxWeightNeighbor(), EdgeDirection.ALL);
List<Tuple2<Long, Long>> result = verticesWithMaxEdgeWeight.collect();
expectedResult = "1,51\n" +
- "2,23\n" +
- "3,35\n" +
- "4,45\n" +
- "5,51\n";
-
+ "2,23\n" +
+ "3,35\n" +
+ "4,45\n" +
+ "5,51\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -337,19 +336,19 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
* of each vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
- graph.reduceOnEdges(new SelectMinWeightNeighborNoValue(), EdgeDirection.OUT);
+ DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
+ graph.reduceOnEdges(new SelectMinWeightNeighborNoValue(), EdgeDirection.OUT);
List<Tuple2<Long, Long>> result = verticesWithLowestOutNeighbor.collect();
expectedResult = "1,12\n" +
- "2,23\n" +
- "3,34\n" +
- "4,45\n" +
- "5,51\n";
-
+ "2,23\n" +
+ "3,34\n" +
+ "4,45\n" +
+ "5,51\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -360,19 +359,19 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
* of each vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
- graph.reduceOnEdges(new SelectMinWeightNeighborNoValue(), EdgeDirection.IN);
+ DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
+ graph.reduceOnEdges(new SelectMinWeightNeighborNoValue(), EdgeDirection.IN);
List<Tuple2<Long, Long>> result = verticesWithLowestOutNeighbor.collect();
expectedResult = "1,51\n" +
- "2,12\n" +
- "3,13\n" +
- "4,34\n" +
- "5,35\n";
-
+ "2,12\n" +
+ "3,13\n" +
+ "4,34\n" +
+ "5,35\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -383,19 +382,19 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
* of a vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithMaxEdgeWeight =
- graph.reduceOnEdges(new SelectMaxWeightNeighborNoValue(), EdgeDirection.ALL);
+ DataSet<Tuple2<Long, Long>> verticesWithMaxEdgeWeight =
+ graph.reduceOnEdges(new SelectMaxWeightNeighborNoValue(), EdgeDirection.ALL);
List<Tuple2<Long, Long>> result = verticesWithMaxEdgeWeight.collect();
expectedResult = "1,51\n" +
- "2,23\n" +
- "3,35\n" +
- "4,45\n" +
- "5,51\n";
-
+ "2,23\n" +
+ "3,35\n" +
+ "4,45\n" +
+ "5,51\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -404,12 +403,12 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Vertex<Long, Long> v,
- Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
-
+ Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
+
long weight = Long.MAX_VALUE;
long minNeighborId = 0;
- for (Edge<Long, Long> edge: edges) {
+ for (Edge<Long, Long> edge : edges) {
if (edge.getValue() < weight) {
weight = edge.getValue();
minNeighborId = edge.getTarget();
@@ -424,11 +423,11 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Vertex<Long, Long> v,
- Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
-
+ Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
+
long weight = Long.MIN_VALUE;
- for (Edge<Long, Long> edge: edges) {
+ for (Edge<Long, Long> edge : edges) {
if (edge.getValue() > weight) {
weight = edge.getValue();
}
@@ -460,12 +459,12 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Vertex<Long, Long> v,
- Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
-
+ Iterable<Edge<Long, Long>> edges, Collector<Tuple2<Long, Long>> out) throws Exception {
+
long weight = Long.MAX_VALUE;
long minNeighborId = 0;
-
- for (Edge<Long, Long> edge: edges) {
+
+ for (Edge<Long, Long> edge : edges) {
if (edge.getValue() < weight) {
weight = edge.getValue();
minNeighborId = edge.getSource();
@@ -480,9 +479,9 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
- for(Tuple2<Long, Edge<Long, Long>> edge : edges) {
+ for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
out.collect(new Tuple2<>(edge.f0, edge.f1.getTarget()));
}
}
@@ -493,10 +492,10 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
- for(Tuple2<Long, Edge<Long, Long>> edge : edges) {
- if(edge.f0 != 5) {
+ for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
+ if (edge.f0 != 5) {
out.collect(new Tuple2<>(edge.f0, edge.f1.getTarget()));
}
}
@@ -505,13 +504,14 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@SuppressWarnings("serial")
private static final class SelectOutNeighborsValueGreaterThanTwo implements
- EdgesFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
+ EdgesFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateEdges(Vertex<Long, Long> v, Iterable<Edge<Long, Long>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
- for (Edge<Long, Long> edge: edges) {
- if(v.getValue() > 2) {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
+
+ for (Edge<Long, Long> edge : edges) {
+ if (v.getValue() > 2) {
out.collect(new Tuple2<>(v.getId(), edge.getTarget()));
}
}
@@ -523,9 +523,9 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
- for(Tuple2<Long, Edge<Long, Long>> edge : edges) {
+ for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
out.collect(new Tuple2<>(edge.f0, edge.f1.getSource()));
}
}
@@ -536,10 +536,10 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
- for(Tuple2<Long, Edge<Long, Long>> edge : edges) {
- if(edge.f0 != 5) {
+ for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
+ if (edge.f0 != 5) {
out.collect(new Tuple2<>(edge.f0, edge.f1.getSource()));
}
}
@@ -548,13 +548,14 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@SuppressWarnings("serial")
private static final class SelectInNeighborsValueGreaterThanTwo implements
- EdgesFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
+ EdgesFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateEdges(Vertex<Long, Long> v, Iterable<Edge<Long, Long>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
- for (Edge<Long, Long> edge: edges) {
- if(v.getValue() > 2) {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
+
+ for (Edge<Long, Long> edge : edges) {
+ if (v.getValue() > 2) {
out.collect(new Tuple2<>(v.getId(), edge.getSource()));
}
}
@@ -566,7 +567,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
if (Objects.equals(edge.f0, edge.f1.getTarget())) {
out.collect(new Tuple2<>(edge.f0, edge.f1.getSource()));
@@ -582,9 +583,10 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@Override
public void iterateEdges(Iterable<Tuple2<Long, Edge<Long, Long>>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
+
for (Tuple2<Long, Edge<Long, Long>> edge : edges) {
- if(edge.f0 != 5 && edge.f0 != 2) {
+ if (edge.f0 != 5 && edge.f0 != 2) {
if (Objects.equals(edge.f0, edge.f1.getTarget())) {
out.collect(new Tuple2<>(edge.f0, edge.f1.getSource()));
} else {
@@ -597,14 +599,15 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@SuppressWarnings("serial")
private static final class SelectNeighborsValueGreaterThanFour implements
- EdgesFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
+ EdgesFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateEdges(Vertex<Long, Long> v, Iterable<Edge<Long, Long>> edges,
- Collector<Tuple2<Long, Long>> out) throws Exception {
- for(Edge<Long, Long> edge : edges) {
- if(v.getValue() > 4) {
- if(v.getId().equals(edge.getTarget())) {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
+
+ for (Edge<Long, Long> edge : edges) {
+ if (v.getValue() > 4) {
+ if (v.getId().equals(edge.getTarget())) {
out.collect(new Tuple2<>(v.getId(), edge.getSource()));
} else {
out.collect(new Tuple2<>(v.getId(), edge.getTarget()));
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
index a352bb4..7fad2e8 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
@@ -41,11 +41,11 @@ import java.util.List;
@RunWith(Parameterized.class)
public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
- public ReduceOnNeighborMethodsITCase(TestExecutionMode mode){
+ public ReduceOnNeighborMethodsITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
+ private String expectedResult;
@Test
public void testSumOfOutNeighbors() throws Exception {
@@ -54,19 +54,19 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
* for each vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
- graph.groupReduceOnNeighbors(new SumOutNeighbors(), EdgeDirection.OUT);
+ DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
+ graph.groupReduceOnNeighbors(new SumOutNeighbors(), EdgeDirection.OUT);
List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
-
+
expectedResult = "1,5\n" +
- "2,3\n" +
- "3,9\n" +
- "4,5\n" +
- "5,1\n";
-
+ "2,3\n" +
+ "3,9\n" +
+ "4,5\n" +
+ "5,1\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -77,22 +77,20 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
* times the edge weights for each vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithSum =
- graph.groupReduceOnNeighbors(new SumInNeighbors(), EdgeDirection.IN);
+ DataSet<Tuple2<Long, Long>> verticesWithSum =
+ graph.groupReduceOnNeighbors(new SumInNeighbors(), EdgeDirection.IN);
List<Tuple2<Long, Long>> result = verticesWithSum.collect();
-
+
expectedResult = "1,255\n" +
- "2,12\n" +
- "3,59\n" +
- "4,102\n" +
- "5,285\n";
-
+ "2,12\n" +
+ "3,59\n" +
+ "4,102\n" +
+ "5,285\n";
+
compareResultAsTuples(result, expectedResult);
-
-
}
@Test
@@ -103,19 +101,19 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
* for each vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
- graph.groupReduceOnNeighbors(new SumAllNeighbors(), EdgeDirection.ALL);
+ DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
+ graph.groupReduceOnNeighbors(new SumAllNeighbors(), EdgeDirection.ALL);
List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "1,11\n" +
- "2,6\n" +
- "3,15\n" +
- "4,12\n" +
- "5,13\n";
-
+ "2,6\n" +
+ "3,15\n" +
+ "4,12\n" +
+ "5,13\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -127,15 +125,15 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
- graph.groupReduceOnNeighbors(new SumOutNeighborsIdGreaterThanThree(), EdgeDirection.OUT);
+ graph.groupReduceOnNeighbors(new SumOutNeighborsIdGreaterThanThree(), EdgeDirection.OUT);
List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
-
+
expectedResult = "4,5\n" +
- "5,1\n";
-
+ "5,1\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -147,15 +145,15 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithSum =
- graph.groupReduceOnNeighbors(new SumInNeighborsIdGreaterThanThree(), EdgeDirection.IN);
+ graph.groupReduceOnNeighbors(new SumInNeighborsIdGreaterThanThree(), EdgeDirection.IN);
List<Tuple2<Long, Long>> result = verticesWithSum.collect();
-
+
expectedResult = "4,102\n" +
- "5,285\n";
-
+ "5,285\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -168,15 +166,15 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
- graph.groupReduceOnNeighbors(new SumAllNeighborsIdGreaterThanThree(), EdgeDirection.ALL);
+ graph.groupReduceOnNeighbors(new SumAllNeighborsIdGreaterThanThree(), EdgeDirection.ALL);
List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "4,12\n" +
- "5,13\n";
-
+ "5,13\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -187,19 +185,19 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
* for each vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
- graph.reduceOnNeighbors(new SumNeighbors(), EdgeDirection.OUT);
+ DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
+ graph.reduceOnNeighbors(new SumNeighbors(), EdgeDirection.OUT);
List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "1,5\n" +
- "2,3\n" +
- "3,9\n" +
- "4,5\n" +
- "5,1\n";
-
+ "2,3\n" +
+ "3,9\n" +
+ "4,5\n" +
+ "5,1\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -210,19 +208,19 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
* times the edge weights for each vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long, Long>> verticesWithSum =
- graph.groupReduceOnNeighbors(new SumInNeighborsNoValue(), EdgeDirection.IN);
+ DataSet<Tuple2<Long, Long>> verticesWithSum =
+ graph.groupReduceOnNeighbors(new SumInNeighborsNoValue(), EdgeDirection.IN);
List<Tuple2<Long, Long>> result = verticesWithSum.collect();
-
+
expectedResult = "1,255\n" +
- "2,12\n" +
- "3,59\n" +
- "4,102\n" +
- "5,285\n";
-
+ "2,12\n" +
+ "3,59\n" +
+ "4,102\n" +
+ "5,285\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -233,19 +231,19 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
* for each vertex
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithSumOfAllNeighborValues =
- graph.reduceOnNeighbors(new SumNeighbors(), EdgeDirection.ALL);
+ graph.reduceOnNeighbors(new SumNeighbors(), EdgeDirection.ALL);
List<Tuple2<Long, Long>> result = verticesWithSumOfAllNeighborValues.collect();
-
+
expectedResult = "1,10\n" +
- "2,4\n" +
- "3,12\n" +
- "4,8\n" +
- "5,8\n";
-
+ "2,4\n" +
+ "3,12\n" +
+ "4,8\n" +
+ "5,8\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -257,19 +255,19 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
- graph.groupReduceOnNeighbors(new SumOutNeighborsNoValueMultipliedByTwoIdGreaterThanTwo(), EdgeDirection.OUT);
+ graph.groupReduceOnNeighbors(new SumOutNeighborsNoValueMultipliedByTwoIdGreaterThanTwo(), EdgeDirection.OUT);
List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "3,9\n" +
- "3,18\n" +
- "4,5\n" +
- "4,10\n" +
- "5,1\n" +
- "5,2";
-
+ "3,18\n" +
+ "4,5\n" +
+ "4,10\n" +
+ "5,1\n" +
+ "5,2";
+
compareResultAsTuples(result, expectedResult);
}
@@ -281,19 +279,19 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
- graph.groupReduceOnNeighbors(new SumInNeighborsNoValueMultipliedByTwoIdGreaterThanTwo(), EdgeDirection.IN);
+ graph.groupReduceOnNeighbors(new SumInNeighborsNoValueMultipliedByTwoIdGreaterThanTwo(), EdgeDirection.IN);
List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "3,59\n" +
- "3,118\n" +
- "4,204\n" +
- "4,102\n" +
- "5,570\n" +
- "5,285";
-
+ "3,118\n" +
+ "4,204\n" +
+ "4,102\n" +
+ "5,570\n" +
+ "5,285";
+
compareResultAsTuples(result, expectedResult);
}
@@ -305,19 +303,19 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithSumOfAllNeighborValues =
- graph.groupReduceOnNeighbors(new SumAllNeighborsNoValueMultipliedByTwoIdGreaterThanTwo(), EdgeDirection.ALL);
+ graph.groupReduceOnNeighbors(new SumAllNeighborsNoValueMultipliedByTwoIdGreaterThanTwo(), EdgeDirection.ALL);
List<Tuple2<Long, Long>> result = verticesWithSumOfAllNeighborValues.collect();
expectedResult = "3,12\n" +
- "3,24\n" +
- "4,8\n" +
- "4,16\n" +
- "5,8\n" +
- "5,16";
-
+ "3,24\n" +
+ "4,8\n" +
+ "4,16\n" +
+ "5,8\n" +
+ "5,16";
+
compareResultAsTuples(result, expectedResult);
}
@@ -329,23 +327,23 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
- graph.groupReduceOnNeighbors(new SumOutNeighborsMultipliedByTwo(), EdgeDirection.OUT);
+ graph.groupReduceOnNeighbors(new SumOutNeighborsMultipliedByTwo(), EdgeDirection.OUT);
List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
-
+
expectedResult = "1,5\n" +
- "1,10\n" +
- "2,3\n" +
- "2,6\n" +
- "3,9\n" +
- "3,18\n" +
- "4,5\n" +
- "4,10\n" +
- "5,1\n" +
- "5,2";
-
+ "1,10\n" +
+ "2,3\n" +
+ "2,6\n" +
+ "3,9\n" +
+ "3,18\n" +
+ "4,5\n" +
+ "4,10\n" +
+ "5,1\n" +
+ "5,2";
+
compareResultAsTuples(result, expectedResult);
}
@@ -357,23 +355,23 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithSum =
- graph.groupReduceOnNeighbors(new SumInNeighborsSubtractOne(), EdgeDirection.IN);
+ graph.groupReduceOnNeighbors(new SumInNeighborsSubtractOne(), EdgeDirection.IN);
List<Tuple2<Long, Long>> result = verticesWithSum.collect();
-
+
expectedResult = "1,255\n" +
- "1,254\n" +
- "2,12\n" +
- "2,11\n" +
- "3,59\n" +
- "3,58\n" +
- "4,102\n" +
- "4,101\n" +
- "5,285\n" +
- "5,284";
-
+ "1,254\n" +
+ "2,12\n" +
+ "2,11\n" +
+ "3,59\n" +
+ "3,58\n" +
+ "4,102\n" +
+ "4,101\n" +
+ "5,285\n" +
+ "5,284";
+
compareResultAsTuples(result, expectedResult);
}
@@ -386,35 +384,35 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
- graph.groupReduceOnNeighbors(new SumAllNeighborsAddFive(), EdgeDirection.ALL);
+ graph.groupReduceOnNeighbors(new SumAllNeighborsAddFive(), EdgeDirection.ALL);
List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "1,11\n" +
- "1,16\n" +
- "2,6\n" +
- "2,11\n" +
- "3,15\n" +
- "3,20\n" +
- "4,12\n" +
- "4,17\n" +
- "5,13\n" +
- "5,18";
-
+ "1,16\n" +
+ "2,6\n" +
+ "2,11\n" +
+ "3,15\n" +
+ "3,20\n" +
+ "4,12\n" +
+ "4,17\n" +
+ "5,13\n" +
+ "5,18";
+
compareResultAsTuples(result, expectedResult);
}
@SuppressWarnings("serial")
- private static final class SumOutNeighbors implements NeighborsFunctionWithVertexValue<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumOutNeighbors implements
+ NeighborsFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
-
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
+
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
sum += neighbor.f1.getValue();
@@ -424,14 +422,14 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class SumInNeighbors implements NeighborsFunctionWithVertexValue<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumInNeighbors implements
+ NeighborsFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
-
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
+
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
sum += neighbor.f0.getValue() * neighbor.f1.getValue();
@@ -441,14 +439,14 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class SumAllNeighbors implements NeighborsFunctionWithVertexValue<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumAllNeighbors implements
+ NeighborsFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
-
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
+
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
sum += neighbor.f1.getValue();
@@ -458,57 +456,57 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class SumOutNeighborsIdGreaterThanThree implements NeighborsFunctionWithVertexValue<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumOutNeighborsIdGreaterThanThree implements
+ NeighborsFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
- sum += neighbor.f1.getValue();
+ sum += neighbor.f1.getValue();
}
- if(vertex.getId() > 3) {
+ if (vertex.getId() > 3) {
out.collect(new Tuple2<>(vertex.getId(), sum));
}
}
}
@SuppressWarnings("serial")
- private static final class SumInNeighborsIdGreaterThanThree implements NeighborsFunctionWithVertexValue<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumInNeighborsIdGreaterThanThree implements
+ NeighborsFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
sum += neighbor.f0.getValue() * neighbor.f1.getValue();
}
- if(vertex.getId() > 3) {
+ if (vertex.getId() > 3) {
out.collect(new Tuple2<>(vertex.getId(), sum));
}
}
}
@SuppressWarnings("serial")
- private static final class SumAllNeighborsIdGreaterThanThree implements NeighborsFunctionWithVertexValue<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumAllNeighborsIdGreaterThanThree implements
+ NeighborsFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
sum += neighbor.f1.getValue();
}
- if(vertex.getId() > 3) {
+ if (vertex.getId() > 3) {
out.collect(new Tuple2<>(vertex.getId(), sum + vertex.getValue()));
}
}
@@ -524,12 +522,12 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class SumInNeighborsNoValue implements NeighborsFunction<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumInNeighborsNoValue implements NeighborsFunction<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Iterable<Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
+
long sum = 0;
Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>> next = null;
for (Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -541,12 +539,12 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class SumOutNeighborsNoValueMultipliedByTwoIdGreaterThanTwo implements NeighborsFunction<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumOutNeighborsNoValueMultipliedByTwoIdGreaterThanTwo implements
+ NeighborsFunction<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Iterable<Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>> next = null;
@@ -554,7 +552,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
next = neighbor;
sum += next.f2.getValue();
}
- if(next.f0 > 2) {
+ if (next.f0 > 2) {
out.collect(new Tuple2<>(next.f0, sum));
out.collect(new Tuple2<>(next.f0, sum * 2));
}
@@ -562,12 +560,12 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class SumInNeighborsNoValueMultipliedByTwoIdGreaterThanTwo implements NeighborsFunction<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumInNeighborsNoValueMultipliedByTwoIdGreaterThanTwo implements
+ NeighborsFunction<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Iterable<Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>> next = null;
@@ -575,7 +573,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
next = neighbor;
sum += next.f2.getValue() * next.f1.getValue();
}
- if(next.f0 > 2) {
+ if (next.f0 > 2) {
out.collect(new Tuple2<>(next.f0, sum));
out.collect(new Tuple2<>(next.f0, sum * 2));
}
@@ -583,12 +581,12 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class SumAllNeighborsNoValueMultipliedByTwoIdGreaterThanTwo implements NeighborsFunction<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumAllNeighborsNoValueMultipliedByTwoIdGreaterThanTwo implements
+ NeighborsFunction<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Iterable<Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
Tuple3<Long, Edge<Long, Long>, Vertex<Long, Long>> next = null;
@@ -596,7 +594,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
next = neighbor;
sum += next.f2.getValue();
}
- if(next.f0 > 2) {
+ if (next.f0 > 2) {
out.collect(new Tuple2<>(next.f0, sum));
out.collect(new Tuple2<>(next.f0, sum * 2));
}
@@ -604,13 +602,13 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class SumOutNeighborsMultipliedByTwo implements NeighborsFunctionWithVertexValue<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumOutNeighborsMultipliedByTwo implements
+ NeighborsFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -622,13 +620,13 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class SumInNeighborsSubtractOne implements NeighborsFunctionWithVertexValue<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumInNeighborsSubtractOne implements
+ NeighborsFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
@@ -640,13 +638,13 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class SumAllNeighborsAddFive implements NeighborsFunctionWithVertexValue<Long, Long, Long,
- Tuple2<Long, Long>> {
+ private static final class SumAllNeighborsAddFive implements
+ NeighborsFunctionWithVertexValue<Long, Long, Long, Tuple2<Long, Long>> {
@Override
public void iterateNeighbors(Vertex<Long, Long> vertex,
- Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
- Collector<Tuple2<Long, Long>> out) throws Exception {
+ Iterable<Tuple2<Edge<Long, Long>, Vertex<Long, Long>>> neighbors,
+ Collector<Tuple2<Long, Long>> out) throws Exception {
long sum = 0;
for (Tuple2<Edge<Long, Long>, Vertex<Long, Long>> neighbor : neighbors) {
[5/6] flink git commit: [hotfix] [gelly] Indent Java with tabs not
spaces
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
index 4d7153d..e03e8cf 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
@@ -40,11 +40,11 @@ import java.util.List;
@RunWith(Parameterized.class)
public class GraphOperationsITCase extends MultipleProgramsTestBase {
- public GraphOperationsITCase(TestExecutionMode mode){
+ public GraphOperationsITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
+ private String expectedResult;
@Test
public void testUndirected() throws Exception {
@@ -54,19 +54,19 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
+ DataSet<Edge<Long, Long>> data = graph.getUndirected().getEdges();
+ List<Edge<Long, Long>> result = data.collect();
- DataSet<Edge<Long, Long>> data = graph.getUndirected().getEdges();
- List<Edge<Long, Long>> result= data.collect();
-
expectedResult = "1,2,12\n" + "2,1,12\n" +
- "1,3,13\n" + "3,1,13\n" +
- "2,3,23\n" + "3,2,23\n" +
- "3,4,34\n" + "4,3,34\n" +
- "3,5,35\n" + "5,3,35\n" +
- "4,5,45\n" + "5,4,45\n" +
- "5,1,51\n" + "1,5,51\n";
-
+ "1,3,13\n" + "3,1,13\n" +
+ "2,3,23\n" + "3,2,23\n" +
+ "3,4,34\n" + "4,3,34\n" +
+ "3,5,35\n" + "5,3,35\n" +
+ "4,5,45\n" + "5,4,45\n" +
+ "5,1,51\n" + "1,5,51\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -78,19 +78,19 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
+ DataSet<Edge<Long, Long>> data = graph.reverse().getEdges();
+ List<Edge<Long, Long>> result = data.collect();
- DataSet<Edge<Long, Long>> data = graph.reverse().getEdges();
- List<Edge<Long, Long>> result= data.collect();
-
expectedResult = "2,1,12\n" +
- "3,1,13\n" +
- "3,2,23\n" +
- "4,3,34\n" +
- "5,3,35\n" +
- "5,4,45\n" +
- "1,5,51\n";
-
+ "3,1,13\n" +
+ "3,2,23\n" +
+ "4,3,34\n" +
+ "5,3,35\n" +
+ "5,4,45\n" +
+ "1,5,51\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -103,24 +103,25 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
- DataSet<Edge<Long, Long>> data= graph.subgraph(new FilterFunction<Vertex<Long, Long>>() {
- public boolean filter(Vertex<Long, Long> vertex) throws Exception {
- return (vertex.getValue() > 2);
- }
- },
- new FilterFunction<Edge<Long, Long>>() {
- public boolean filter(Edge<Long, Long> edge) throws Exception {
- return (edge.getValue() > 34);
- }
- }).getEdges();
-
- List<Edge<Long, Long>> result= data.collect();
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
+ DataSet<Edge<Long, Long>> data = graph.subgraph(
+ new FilterFunction<Vertex<Long, Long>>() {
+ public boolean filter(Vertex<Long, Long> vertex) throws Exception {
+ return (vertex.getValue() > 2);
+ }
+ },
+ new FilterFunction<Edge<Long, Long>>() {
+ public boolean filter(Edge<Long, Long> edge) throws Exception {
+ return (edge.getValue() > 34);
+ }
+ }).getEdges();
+
+ List<Edge<Long, Long>> result = data.collect();
+
expectedResult = "3,5,35\n" +
- "4,5,45\n";
-
+ "4,5,45\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -133,20 +134,20 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Edge<Long, Long>> data = graph.filterOnVertices(new FilterFunction<Vertex<Long, Long>>() {
public boolean filter(Vertex<Long, Long> vertex) throws Exception {
return (vertex.getValue() > 2);
}
}).getEdges();
- List<Edge<Long, Long>> result= data.collect();
-
- expectedResult = "3,4,34\n" +
- "3,5,35\n" +
- "4,5,45\n";
-
+ List<Edge<Long, Long>> result = data.collect();
+
+ expectedResult = "3,4,34\n" +
+ "3,5,35\n" +
+ "4,5,45\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -159,20 +160,20 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Edge<Long, Long>> data = graph.filterOnEdges(new FilterFunction<Edge<Long, Long>>() {
public boolean filter(Edge<Long, Long> edge) throws Exception {
return (edge.getValue() > 34);
}
}).getEdges();
- List<Edge<Long, Long>> result = data.collect();
-
+ List<Edge<Long, Long>> result = data.collect();
+
expectedResult = "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
+ "4,5,45\n" +
+ "5,1,51\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -184,13 +185,13 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Long> data = env.fromElements(graph.numberOfVertices());
- List<Long> result= data.collect();
-
+ List<Long> result = data.collect();
+
expectedResult = "5";
-
+
compareResultAsText(result, expectedResult);
}
@@ -202,13 +203,13 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Long> data = env.fromElements(graph.numberOfEdges());
- List<Long> result= data.collect();
-
+ List<Long> result = data.collect();
+
expectedResult = "7";
-
+
compareResultAsText(result, expectedResult);
}
@@ -220,13 +221,13 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Long> data = graph.getVertexIds();
- List<Long> result= data.collect();
-
+ List<Long> result = data.collect();
+
expectedResult = "1\n2\n3\n4\n5\n";
-
+
compareResultAsText(result, expectedResult);
}
@@ -238,16 +239,16 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Tuple2<Long, Long>> data = graph.getEdgeIds();
- List<Tuple2<Long, Long>> result= data.collect();
-
+ List<Tuple2<Long, Long>> result = data.collect();
+
expectedResult = "1,2\n" + "1,3\n" +
- "2,3\n" + "3,4\n" +
- "3,5\n" + "4,5\n" +
- "5,1\n";
-
+ "2,3\n" + "3,4\n" +
+ "3,5\n" + "4,5\n" +
+ "5,1\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -259,7 +260,7 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
List<Vertex<Long, Long>> vertices = new ArrayList<>();
List<Edge<Long, Long>> edges = new ArrayList<>();
@@ -269,18 +270,18 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
graph = graph.union(Graph.fromCollection(vertices, edges, env));
- DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
expectedResult = "1,2,12\n" +
- "1,3,13\n" +
- "2,3,23\n" +
- "3,4,34\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n" +
- "6,1,61\n";
-
+ "1,3,13\n" +
+ "2,3,23\n" +
+ "3,4,34\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n" +
+ "6,1,61\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -291,10 +292,10 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
Graph<Long, Long, Long> graph2 = Graph.fromDataSet(TestGraphUtils.getLongLongVertexDataDifference(env),
- TestGraphUtils.getLongLongEdgeDataDifference(env), env);
+ TestGraphUtils.getLongLongEdgeDataDifference(env), env);
graph = graph.difference(graph2);
@@ -305,24 +306,24 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
}
@Test
- public void testDifferenceVertices() throws Exception{
+ public void testDifferenceVertices() throws Exception {
/*Test difference() method by checking the output for getVertices() on the resultant graph
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
Graph<Long, Long, Long> graph2 = Graph.fromDataSet(TestGraphUtils.getLongLongVertexDataDifference(env),
- TestGraphUtils.getLongLongEdgeDataDifference(env), env);
+ TestGraphUtils.getLongLongEdgeDataDifference(env), env);
graph = graph.difference(graph2);
List<Vertex<Long, Long>> result = graph.getVertices().collect();
- expectedResult = "2,2\n" +
- "4,4\n" +
- "5,5\n" ;
+ expectedResult = "2,2\n" +
+ "4,4\n" +
+ "5,5\n";
compareResultAsTuples(result, expectedResult);
}
@@ -335,7 +336,7 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
DataSet<Vertex<Long, Long>> vertex = env.fromElements(new Vertex<>(6L, 6L));
@@ -345,13 +346,13 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
List<Edge<Long, Long>> result = graph.getEdges().collect();
- expectedResult = "1,2,12\n" +
- "1,3,13\n" +
- "2,3,23\n" +
- "3,4,34\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n" ;
+ expectedResult = "1,2,12\n" +
+ "1,3,13\n" +
+ "2,3,23\n" +
+ "3,4,34\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
compareResultAsTuples(result, expectedResult);
}
@@ -423,14 +424,14 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
env.execute();
String expectedVertices = "1,(null)\n" +
- "3,(null)\n";
+ "3,(null)\n";
String expectedEdges = "1,3,13\n" +
- "1,3,13\n" +
- "1,3,13\n" +
- "1,3,13\n" +
- "1,3,14\n" +
- "1,3,14";
+ "1,3,13\n" +
+ "1,3,13\n" +
+ "1,3,13\n" +
+ "1,3,14\n" +
+ "1,3,14";
compareResultAsTuples(vertices, expectedVertices);
compareResultAsTuples(edges, expectedEdges);
@@ -444,16 +445,16 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Triplet<Long, Long, Long>> data = graph.getTriplets();
- List<Triplet<Long, Long, Long>> result= data.collect();
+ DataSet<Triplet<Long, Long, Long>> data = graph.getTriplets();
+ List<Triplet<Long, Long, Long>> result = data.collect();
expectedResult = "1,2,1,2,12\n" + "1,3,1,3,13\n" +
- "2,3,2,3,23\n" + "3,4,3,4,34\n" +
- "3,5,3,5,35\n" + "4,5,4,5,45\n" +
- "5,1,5,1,51\n";
-
+ "2,3,2,3,23\n" + "3,4,3,4,34\n" +
+ "3,5,3,5,35\n" + "4,5,4,5,45\n" +
+ "5,1,5,1,51\n";
+
compareResultAsTuples(result, expectedResult);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
index cb83b33..6988218 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
@@ -39,11 +39,11 @@ import java.util.List;
@RunWith(Parameterized.class)
public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
- public JoinWithEdgesITCase(TestExecutionMode mode){
+ public JoinWithEdgesITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
+ private String expectedResult;
@Test
public void testWithEdgesInputDataset() throws Exception {
@@ -51,416 +51,416 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
* Test joinWithEdges with the input DataSet parameter identical
* to the edge DataSet
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithEdges(graph.getEdges()
- .map(new EdgeToTuple3Map<Long, Long>()), new AddValuesMapper());
+ Graph<Long, Long, Long> res = graph.joinWithEdges(graph.getEdges()
+ .map(new EdgeToTuple3Map<Long, Long>()), new AddValuesMapper());
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2,24\n" +
+ "1,3,26\n" +
+ "2,3,46\n" +
+ "3,4,68\n" +
+ "3,5,70\n" +
+ "4,5,90\n" +
+ "5,1,102\n";
- expectedResult = "1,2,24\n" +
- "1,3,26\n" +
- "2,3,46\n" +
- "3,4,68\n" +
- "3,5,70\n" +
- "4,5,90\n" +
- "5,1,102\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithLessElements() throws Exception {
- /*
+ /*
* Test joinWithEdges with the input DataSet passed as a parameter containing
* less elements than the edge DataSet, but of the same type
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> res = graph.joinWithEdges(graph.getEdges().first(3)
+ .map(new EdgeToTuple3Map<Long, Long>()), new AddValuesMapper());
- Graph<Long, Long, Long> res = graph.joinWithEdges(graph.getEdges().first(3)
- .map(new EdgeToTuple3Map<Long, Long>()), new AddValuesMapper());
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ expectedResult = "1,2,24\n" +
+ "1,3,26\n" +
+ "2,3,46\n" +
+ "3,4,34\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
- expectedResult = "1,2,24\n" +
- "1,3,26\n" +
- "2,3,46\n" +
- "3,4,34\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithLessElementsDifferentType() throws Exception {
- /*
+ /*
* Test joinWithEdges with the input DataSet passed as a parameter containing
* less elements than the edge DataSet and of a different type(Boolean)
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithEdges(graph.getEdges().first(3)
- .map(new BooleanEdgeValueMapper()), new DoubleIfTrueMapper());
+ Graph<Long, Long, Long> res = graph.joinWithEdges(graph.getEdges().first(3)
+ .map(new BooleanEdgeValueMapper()), new DoubleIfTrueMapper());
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2,24\n" +
+ "1,3,26\n" +
+ "2,3,46\n" +
+ "3,4,34\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
- expectedResult = "1,2,24\n" +
- "1,3,26\n" +
- "2,3,46\n" +
- "3,4,34\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithNoCommonKeys() throws Exception {
- /*
+ /*
* Test joinWithEdges with the input DataSet containing different keys than the edge DataSet
* - the iterator becomes empty.
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> res = graph.joinWithEdges(TestGraphUtils.getLongLongLongTuple3Data(env),
+ new DoubleValueMapper());
- Graph<Long, Long, Long> res = graph.joinWithEdges(TestGraphUtils.getLongLongLongTuple3Data(env),
- new DoubleValueMapper());
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ expectedResult = "1,2,24\n" +
+ "1,3,26\n" +
+ "2,3,46\n" +
+ "3,4,68\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
- expectedResult = "1,2,24\n" +
- "1,3,26\n" +
- "2,3,46\n" +
- "3,4,68\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithCustomType() throws Exception {
- /*
+ /*
* Test joinWithEdges with a DataSet containing custom parametrised type input values
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithEdges(TestGraphUtils.getLongLongCustomTuple3Data(env),
- new CustomValueMapper());
+ Graph<Long, Long, Long> res = graph.joinWithEdges(TestGraphUtils.getLongLongCustomTuple3Data(env),
+ new CustomValueMapper());
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2,10\n" +
+ "1,3,20\n" +
+ "2,3,30\n" +
+ "3,4,40\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
- expectedResult = "1,2,10\n" +
- "1,3,20\n" +
- "2,3,30\n" +
- "3,4,40\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithEdgesOnSource() throws Exception {
- /*
+ /*
* Test joinWithEdgesOnSource with the input DataSet parameter identical
* to the edge DataSet
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(graph.getEdges()
+ .map(new ProjectSourceAndValueMapper()), new AddValuesMapper());
- Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(graph.getEdges()
- .map(new ProjectSourceAndValueMapper()), new AddValuesMapper());
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ expectedResult = "1,2,24\n" +
+ "1,3,25\n" +
+ "2,3,46\n" +
+ "3,4,68\n" +
+ "3,5,69\n" +
+ "4,5,90\n" +
+ "5,1,102\n";
- expectedResult = "1,2,24\n" +
- "1,3,25\n" +
- "2,3,46\n" +
- "3,4,68\n" +
- "3,5,69\n" +
- "4,5,90\n" +
- "5,1,102\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testOnSourceWithLessElements() throws Exception {
- /*
+ /*
* Test joinWithEdgesOnSource with the input DataSet passed as a parameter containing
* less elements than the edge DataSet, but of the same type
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(graph.getEdges().first(3)
- .map(new ProjectSourceAndValueMapper()), new AddValuesMapper());
+ Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(graph.getEdges().first(3)
+ .map(new ProjectSourceAndValueMapper()), new AddValuesMapper());
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2,24\n" +
+ "1,3,25\n" +
+ "2,3,46\n" +
+ "3,4,34\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
- expectedResult = "1,2,24\n" +
- "1,3,25\n" +
- "2,3,46\n" +
- "3,4,34\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testOnSourceWithDifferentType() throws Exception {
- /*
+ /*
* Test joinWithEdgesOnSource with the input DataSet passed as a parameter containing
* less elements than the edge DataSet and of a different type(Boolean)
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(graph.getEdges().first(3)
+ .map(new ProjectSourceWithTrueMapper()), new DoubleIfTrueMapper());
- Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(graph.getEdges().first(3)
- .map(new ProjectSourceWithTrueMapper()), new DoubleIfTrueMapper());
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ expectedResult = "1,2,24\n" +
+ "1,3,26\n" +
+ "2,3,46\n" +
+ "3,4,34\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
- expectedResult = "1,2,24\n" +
- "1,3,26\n" +
- "2,3,46\n" +
- "3,4,34\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testOnSourceWithNoCommonKeys() throws Exception {
- /*
+ /*
* Test joinWithEdgesOnSource with the input DataSet containing different keys than the edge DataSet
* - the iterator becomes empty.
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(TestGraphUtils.getLongLongTuple2SourceData(env),
- new DoubleValueMapper());
+ Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(TestGraphUtils.getLongLongTuple2SourceData(env),
+ new DoubleValueMapper());
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2,20\n" +
+ "1,3,20\n" +
+ "2,3,60\n" +
+ "3,4,80\n" +
+ "3,5,80\n" +
+ "4,5,120\n" +
+ "5,1,51\n";
- expectedResult = "1,2,20\n" +
- "1,3,20\n" +
- "2,3,60\n" +
- "3,4,80\n" +
- "3,5,80\n" +
- "4,5,120\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testOnSourceWithCustom() throws Exception {
- /*
+ /*
* Test joinWithEdgesOnSource with a DataSet containing custom parametrised type input values
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(TestGraphUtils.getLongCustomTuple2SourceData(env),
+ new CustomValueMapper());
- Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(TestGraphUtils.getLongCustomTuple2SourceData(env),
- new CustomValueMapper());
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ expectedResult = "1,2,10\n" +
+ "1,3,10\n" +
+ "2,3,30\n" +
+ "3,4,40\n" +
+ "3,5,40\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
- expectedResult = "1,2,10\n" +
- "1,3,10\n" +
- "2,3,30\n" +
- "3,4,40\n" +
- "3,5,40\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithEdgesOnTarget() throws Exception {
- /*
- * Test joinWithEdgesOnTarget with the input DataSet parameter identical
- * to the edge DataSet
- */
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
- Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(graph.getEdges()
- .map(new ProjectTargetAndValueMapper()), new AddValuesMapper());
-
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
-
- expectedResult = "1,2,24\n" +
- "1,3,26\n" +
- "2,3,36\n" +
- "3,4,68\n" +
- "3,5,70\n" +
- "4,5,80\n" +
- "5,1,102\n";
-
+ /*
+ * Test joinWithEdgesOnTarget with the input DataSet parameter identical
+ * to the edge DataSet
+ */
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
+ Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(graph.getEdges()
+ .map(new ProjectTargetAndValueMapper()), new AddValuesMapper());
+
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2,24\n" +
+ "1,3,26\n" +
+ "2,3,36\n" +
+ "3,4,68\n" +
+ "3,5,70\n" +
+ "4,5,80\n" +
+ "5,1,102\n";
+
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithOnTargetWithLessElements() throws Exception {
- /*
+ /*
* Test joinWithEdgesOnTarget with the input DataSet passed as a parameter containing
* less elements than the edge DataSet, but of the same type
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(graph.getEdges().first(3)
+ .map(new ProjectTargetAndValueMapper()), new AddValuesMapper());
- Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(graph.getEdges().first(3)
- .map(new ProjectTargetAndValueMapper()), new AddValuesMapper());
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ expectedResult = "1,2,24\n" +
+ "1,3,26\n" +
+ "2,3,36\n" +
+ "3,4,34\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
- expectedResult = "1,2,24\n" +
- "1,3,26\n" +
- "2,3,36\n" +
- "3,4,34\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testOnTargetWithDifferentType() throws Exception {
- /*
+ /*
* Test joinWithEdgesOnTarget with the input DataSet passed as a parameter containing
* less elements than the edge DataSet and of a different type(Boolean)
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(graph.getEdges().first(3)
- .map(new ProjectTargetWithTrueMapper()), new DoubleIfTrueMapper());
+ Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(graph.getEdges().first(3)
+ .map(new ProjectTargetWithTrueMapper()), new DoubleIfTrueMapper());
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2,24\n" +
+ "1,3,26\n" +
+ "2,3,46\n" +
+ "3,4,34\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
- expectedResult = "1,2,24\n" +
- "1,3,26\n" +
- "2,3,46\n" +
- "3,4,34\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testOnTargetWithNoCommonKeys() throws Exception {
- /*
+ /*
* Test joinWithEdgesOnTarget with the input DataSet containing different keys than the edge DataSet
* - the iterator becomes empty.
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(TestGraphUtils.getLongLongTuple2TargetData(env),
+ new DoubleValueMapper());
- Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(TestGraphUtils.getLongLongTuple2TargetData(env),
- new DoubleValueMapper());
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ expectedResult = "1,2,20\n" +
+ "1,3,40\n" +
+ "2,3,40\n" +
+ "3,4,80\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,140\n";
- expectedResult = "1,2,20\n" +
- "1,3,40\n" +
- "2,3,40\n" +
- "3,4,80\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,140\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testOnTargetWithCustom() throws Exception {
- /*
+ /*
* Test joinWithEdgesOnTarget with a DataSet containing custom parametrised type input values
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(TestGraphUtils.getLongCustomTuple2TargetData(env),
- new CustomValueMapper());
+ Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(TestGraphUtils.getLongCustomTuple2TargetData(env),
+ new CustomValueMapper());
- DataSet<Edge<Long, Long>> data = res.getEdges();
- List<Edge<Long, Long>> result= data.collect();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2,10\n" +
+ "1,3,20\n" +
+ "2,3,20\n" +
+ "3,4,40\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
- expectedResult = "1,2,10\n" +
- "1,3,20\n" +
- "2,3,20\n" +
- "3,4,40\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
compareResultAsTuples(result, expectedResult);
- }
+ }
@SuppressWarnings("serial")
private static final class AddValuesMapper implements EdgeJoinFunction<Long, Long> {
@@ -472,67 +472,64 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
@SuppressWarnings("serial")
private static final class BooleanEdgeValueMapper implements MapFunction<Edge<Long, Long>, Tuple3<Long, Long, Boolean>> {
- public Tuple3<Long, Long, Boolean> map(Edge<Long, Long> edge) throws Exception {
- return new Tuple3<>(edge.getSource(), edge.getTarget(), true);
- }
- }
+ public Tuple3<Long, Long, Boolean> map(Edge<Long, Long> edge) throws Exception {
+ return new Tuple3<>(edge.getSource(), edge.getTarget(), true);
+ }
+ }
@SuppressWarnings("serial")
private static final class DoubleIfTrueMapper implements EdgeJoinFunction<Long, Boolean> {
public Long edgeJoin(Long edgeValue, Boolean inputValue) {
- if(inputValue) {
- return edgeValue * 2;
- }
- else {
- return edgeValue;
- }
+ if (inputValue) {
+ return edgeValue * 2;
+ } else {
+ return edgeValue;
+ }
}
- }
+ }
@SuppressWarnings("serial")
private static final class DoubleValueMapper implements EdgeJoinFunction<Long, Long> {
-
+
public Long edgeJoin(Long edgeValue, Long inputValue) {
- return inputValue*2;
+ return inputValue * 2;
}
- }
+ }
@SuppressWarnings("serial")
- private static final class CustomValueMapper implements EdgeJoinFunction<
- Long, DummyCustomParameterizedType<Float>> {
+ private static final class CustomValueMapper implements EdgeJoinFunction<Long, DummyCustomParameterizedType<Float>> {
- public Long edgeJoin(Long edgeValue,
- DummyCustomParameterizedType<Float> inputValue) {
+ public Long edgeJoin(Long edgeValue, DummyCustomParameterizedType<Float> inputValue) {
return (long) inputValue.getIntField();
}
- }
+ }
@SuppressWarnings("serial")
private static final class ProjectSourceAndValueMapper implements MapFunction<Edge<Long, Long>, Tuple2<Long, Long>> {
- public Tuple2<Long, Long> map(Edge<Long, Long> edge) throws Exception {
- return new Tuple2<>(edge.getSource(), edge.getValue());
- }
- }
+ public Tuple2<Long, Long> map(Edge<Long, Long> edge) throws Exception {
+ return new Tuple2<>(edge.getSource(), edge.getValue());
+ }
+ }
@SuppressWarnings("serial")
private static final class ProjectSourceWithTrueMapper implements MapFunction<Edge<Long, Long>, Tuple2<Long, Boolean>> {
- public Tuple2<Long, Boolean> map(Edge<Long, Long> edge) throws Exception {
- return new Tuple2<>(edge.getSource(), true);
- }
- }
+ public Tuple2<Long, Boolean> map(Edge<Long, Long> edge) throws Exception {
+ return new Tuple2<>(edge.getSource(), true);
+ }
+ }
@SuppressWarnings("serial")
private static final class ProjectTargetAndValueMapper implements MapFunction<Edge<Long, Long>, Tuple2<Long, Long>> {
- public Tuple2<Long, Long> map(Edge<Long, Long> edge) throws Exception {
- return new Tuple2<>(edge.getTarget(), edge.getValue());
- }
- }
+ public Tuple2<Long, Long> map(Edge<Long, Long> edge) throws Exception {
+ return new Tuple2<>(edge.getTarget(), edge.getValue());
+ }
+ }
@SuppressWarnings("serial")
private static final class ProjectTargetWithTrueMapper implements MapFunction<Edge<Long, Long>, Tuple2<Long, Boolean>> {
- public Tuple2<Long, Boolean> map(Edge<Long, Long> edge) throws Exception {
- return new Tuple2<>(edge.getTarget(), true);
- }
- }
+ public Tuple2<Long, Boolean> map(Edge<Long, Long> edge) throws Exception {
+ return new Tuple2<>(edge.getTarget(), true);
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
index 29badba..7676e8c 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
@@ -38,11 +38,11 @@ import java.util.List;
@RunWith(Parameterized.class)
public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
- public JoinWithVerticesITCase(TestExecutionMode mode){
+ public JoinWithVerticesITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
+ private String expectedResult;
@Test
public void testJoinWithVertexSet() throws Exception {
@@ -50,77 +50,77 @@ public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
* Test joinWithVertices with the input DataSet parameter identical
* to the vertex DataSet
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithVertices(graph.getVertices()
- .map(new VertexToTuple2Map<Long, Long>()), new AddValuesMapper());
+ Graph<Long, Long, Long> res = graph.joinWithVertices(graph.getVertices()
+ .map(new VertexToTuple2Map<Long, Long>()), new AddValuesMapper());
DataSet<Vertex<Long, Long>> data = res.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
-
- expectedResult = "1,2\n" +
- "2,4\n" +
- "3,6\n" +
- "4,8\n" +
- "5,10\n";
-
+ List<Vertex<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2\n" +
+ "2,4\n" +
+ "3,6\n" +
+ "4,8\n" +
+ "5,10\n";
+
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithLessElements() throws Exception {
- /*
- * Test joinWithVertices with the input DataSet passed as a parameter containing
- * less elements than the vertex DataSet, but of the same type
- */
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ /*
+ * Test joinWithVertices with the input DataSet passed as a parameter containing
+ * less elements than the vertex DataSet, but of the same type
+ */
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithVertices(graph.getVertices().first(3)
- .map(new VertexToTuple2Map<Long, Long>()), new AddValuesMapper());
+ Graph<Long, Long, Long> res = graph.joinWithVertices(graph.getVertices().first(3)
+ .map(new VertexToTuple2Map<Long, Long>()), new AddValuesMapper());
DataSet<Vertex<Long, Long>> data = res.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
-
- expectedResult = "1,2\n" +
- "2,4\n" +
- "3,6\n" +
- "4,4\n" +
- "5,5\n";
-
+ List<Vertex<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2\n" +
+ "2,4\n" +
+ "3,6\n" +
+ "4,4\n" +
+ "5,5\n";
+
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithDifferentType() throws Exception {
- /*
- * Test joinWithVertices with the input DataSet passed as a parameter containing
- * less elements than the vertex DataSet and of a different type(Boolean)
- */
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ /*
+ * Test joinWithVertices with the input DataSet passed as a parameter containing
+ * less elements than the vertex DataSet and of a different type(Boolean)
+ */
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithVertices(graph.getVertices().first(3)
- .map(new ProjectIdWithTrue()), new DoubleIfTrueMapper());
+ Graph<Long, Long, Long> res = graph.joinWithVertices(graph.getVertices().first(3)
+ .map(new ProjectIdWithTrue()), new DoubleIfTrueMapper());
DataSet<Vertex<Long, Long>> data = res.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
-
- expectedResult = "1,2\n" +
- "2,4\n" +
- "3,6\n" +
- "4,4\n" +
- "5,5\n";
-
+ List<Vertex<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2\n" +
+ "2,4\n" +
+ "3,6\n" +
+ "4,4\n" +
+ "5,5\n";
+
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithDifferentKeys() throws Exception {
@@ -128,50 +128,50 @@ public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
* Test joinWithVertices with an input DataSet containing different keys than the vertex DataSet
* - the iterator becomes empty.
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithVertices(TestGraphUtils.getLongLongTuple2Data(env),
- new ProjectSecondMapper());
+ Graph<Long, Long, Long> res = graph.joinWithVertices(TestGraphUtils.getLongLongTuple2Data(env),
+ new ProjectSecondMapper());
DataSet<Vertex<Long, Long>> data = res.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
-
- expectedResult = "1,10\n" +
- "2,20\n" +
- "3,30\n" +
- "4,40\n" +
- "5,5\n";
-
+ List<Vertex<Long, Long>> result = data.collect();
+
+ expectedResult = "1,10\n" +
+ "2,20\n" +
+ "3,30\n" +
+ "4,40\n" +
+ "5,5\n";
+
compareResultAsTuples(result, expectedResult);
- }
+ }
@Test
public void testWithCustomType() throws Exception {
/*
* Test joinWithVertices with a DataSet containing custom parametrised type input values
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
- Graph<Long, Long, Long> res = graph.joinWithVertices(TestGraphUtils.getLongCustomTuple2Data(env),
- new CustomValueMapper());
+ Graph<Long, Long, Long> res = graph.joinWithVertices(TestGraphUtils.getLongCustomTuple2Data(env),
+ new CustomValueMapper());
DataSet<Vertex<Long, Long>> data = res.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
-
- expectedResult = "1,10\n" +
- "2,20\n" +
- "3,30\n" +
- "4,40\n" +
- "5,5\n";
-
+ List<Vertex<Long, Long>> result = data.collect();
+
+ expectedResult = "1,10\n" +
+ "2,20\n" +
+ "3,30\n" +
+ "4,40\n" +
+ "5,5\n";
+
compareResultAsTuples(result, expectedResult);
- }
+ }
@SuppressWarnings("serial")
private static final class AddValuesMapper implements VertexJoinFunction<Long, Long> {
@@ -183,23 +183,22 @@ public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
@SuppressWarnings("serial")
private static final class ProjectIdWithTrue implements MapFunction<Vertex<Long, Long>, Tuple2<Long, Boolean>> {
- public Tuple2<Long, Boolean> map(Vertex<Long, Long> vertex) throws Exception {
- return new Tuple2<>(vertex.getId(), true);
- }
- }
+ public Tuple2<Long, Boolean> map(Vertex<Long, Long> vertex) throws Exception {
+ return new Tuple2<>(vertex.getId(), true);
+ }
+ }
@SuppressWarnings("serial")
private static final class DoubleIfTrueMapper implements VertexJoinFunction<Long, Boolean> {
public Long vertexJoin(Long vertexValue, Boolean inputValue) {
- if(inputValue) {
- return vertexValue * 2;
- }
- else {
- return vertexValue;
- }
+ if (inputValue) {
+ return vertexValue * 2;
+ } else {
+ return vertexValue;
+ }
}
- }
+ }
@SuppressWarnings("serial")
private static final class ProjectSecondMapper implements VertexJoinFunction<Long, Long> {
@@ -207,7 +206,7 @@ public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
public Long vertexJoin(Long vertexValue, Long inputValue) {
return inputValue;
}
- }
+ }
@SuppressWarnings("serial")
private static final class CustomValueMapper implements VertexJoinFunction<Long,
@@ -216,5 +215,5 @@ public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
public Long vertexJoin(Long vertexValue, DummyCustomParameterizedType<Float> inputValue) {
return (long) inputValue.getIntField();
}
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapEdgesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapEdgesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapEdgesITCase.java
index 5e751a5..34a2518 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapEdgesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapEdgesITCase.java
@@ -18,8 +18,6 @@
package org.apache.flink.graph.test.operations;
-import java.util.List;
-
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
@@ -34,14 +32,16 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import java.util.List;
+
@RunWith(Parameterized.class)
public class MapEdgesITCase extends MultipleProgramsTestBase {
- public MapEdgesITCase(TestExecutionMode mode){
+ public MapEdgesITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
+ private String expectedResult;
@Test
public void testWithSameValue() throws Exception {
@@ -49,21 +49,21 @@ public class MapEdgesITCase extends MultipleProgramsTestBase {
* Test mapEdges() keeping the same value type
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Edge<Long, Long>> mappedEdges = graph.mapEdges(new AddOneMapper()).getEdges();
- List<Edge<Long, Long>> result= mappedEdges.collect();
-
+ List<Edge<Long, Long>> result = mappedEdges.collect();
+
expectedResult = "1,2,13\n" +
- "1,3,14\n" +
- "2,3,24\n" +
- "3,4,35\n" +
- "3,5,36\n" +
- "4,5,46\n" +
- "5,1,52\n";
-
+ "1,3,14\n" +
+ "2,3,24\n" +
+ "3,4,35\n" +
+ "3,5,36\n" +
+ "4,5,46\n" +
+ "5,1,52\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -73,21 +73,21 @@ public class MapEdgesITCase extends MultipleProgramsTestBase {
* Test mapEdges() and change the value type to String
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Edge<Long, String>> mappedEdges = graph.mapEdges(new ToStringMapper()).getEdges();
- List<Edge<Long, String>> result= mappedEdges.collect();
-
+ List<Edge<Long, String>> result = mappedEdges.collect();
+
expectedResult = "1,2,string(12)\n" +
- "1,3,string(13)\n" +
- "2,3,string(23)\n" +
- "3,4,string(34)\n" +
- "3,5,string(35)\n" +
- "4,5,string(45)\n" +
- "5,1,string(51)\n";
-
+ "1,3,string(13)\n" +
+ "2,3,string(23)\n" +
+ "3,4,string(34)\n" +
+ "3,5,string(35)\n" +
+ "4,5,string(45)\n" +
+ "5,1,string(51)\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -97,21 +97,21 @@ public class MapEdgesITCase extends MultipleProgramsTestBase {
* Test mapEdges() and change the value type to a Tuple1
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Edge<Long, Tuple1<Long>>> mappedEdges = graph.mapEdges(new ToTuple1Mapper()).getEdges();
- List<Edge<Long, Tuple1<Long>>> result= mappedEdges.collect();
+ List<Edge<Long, Tuple1<Long>>> result = mappedEdges.collect();
expectedResult = "1,2,(12)\n" +
- "1,3,(13)\n" +
- "2,3,(23)\n" +
- "3,4,(34)\n" +
- "3,5,(35)\n" +
- "4,5,(45)\n" +
- "5,1,(51)\n";
-
+ "1,3,(13)\n" +
+ "2,3,(23)\n" +
+ "3,4,(34)\n" +
+ "3,5,(35)\n" +
+ "4,5,(45)\n" +
+ "5,1,(51)\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -121,21 +121,21 @@ public class MapEdgesITCase extends MultipleProgramsTestBase {
* Test mapEdges() and change the value type to a custom type
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Edge<Long, DummyCustomType>> mappedEdges = graph.mapEdges(new ToCustomTypeMapper()).getEdges();
- List<Edge<Long, DummyCustomType>> result= mappedEdges.collect();
+ List<Edge<Long, DummyCustomType>> result = mappedEdges.collect();
expectedResult = "1,2,(T,12)\n" +
"1,3,(T,13)\n" +
"2,3,(T,23)\n" +
"3,4,(T,34)\n" +
- "3,5,(T,35)\n" +
- "4,5,(T,45)\n" +
+ "3,5,(T,35)\n" +
+ "4,5,(T,45)\n" +
"5,1,(T,51)\n";
-
+
compareResultAsTuples(result, expectedResult);
}
@@ -145,29 +145,29 @@ public class MapEdgesITCase extends MultipleProgramsTestBase {
* Test mapEdges() and change the value type to a parameterized custom type
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Edge<Long, DummyCustomParameterizedType<Double>>> mappedEdges = graph.mapEdges(
- new ToCustomParametrizedTypeMapper()).getEdges();
- List<Edge<Long, DummyCustomParameterizedType<Double>>> result= mappedEdges.collect();
-
+ new ToCustomParametrizedTypeMapper()).getEdges();
+ List<Edge<Long, DummyCustomParameterizedType<Double>>> result = mappedEdges.collect();
+
expectedResult = "1,2,(12.0,12)\n" +
"1,3,(13.0,13)\n" +
"2,3,(23.0,23)\n" +
"3,4,(34.0,34)\n" +
- "3,5,(35.0,35)\n" +
- "4,5,(45.0,45)\n" +
+ "3,5,(35.0,35)\n" +
+ "4,5,(45.0,45)\n" +
"5,1,(51.0,51)\n";
-
+
compareResultAsTuples(result, expectedResult);
}
@SuppressWarnings("serial")
private static final class AddOneMapper implements MapFunction<Edge<Long, Long>, Long> {
public Long map(Edge<Long, Long> edge) throws Exception {
- return edge.getValue()+1;
+ return edge.getValue() + 1;
}
}
@@ -191,19 +191,19 @@ public class MapEdgesITCase extends MultipleProgramsTestBase {
private static final class ToCustomTypeMapper implements MapFunction<Edge<Long, Long>, DummyCustomType> {
public DummyCustomType map(Edge<Long, Long> edge) throws Exception {
DummyCustomType dummyValue = new DummyCustomType();
- dummyValue.setIntField(edge.getValue().intValue());
+ dummyValue.setIntField(edge.getValue().intValue());
return dummyValue;
}
}
@SuppressWarnings("serial")
- private static final class ToCustomParametrizedTypeMapper implements MapFunction<Edge<Long, Long>,
+ private static final class ToCustomParametrizedTypeMapper implements MapFunction<Edge<Long, Long>,
DummyCustomParameterizedType<Double>> {
public DummyCustomParameterizedType<Double> map(Edge<Long, Long> edge) throws Exception {
DummyCustomParameterizedType<Double> dummyValue = new DummyCustomParameterizedType<>();
dummyValue.setIntField(edge.getValue().intValue());
- dummyValue.setTField(new Double(edge.getValue()));
+ dummyValue.setTField(new Double(edge.getValue()));
return dummyValue;
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapVerticesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapVerticesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapVerticesITCase.java
index 108be3e..24aae7b 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapVerticesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/MapVerticesITCase.java
@@ -18,8 +18,6 @@
package org.apache.flink.graph.test.operations;
-import java.util.List;
-
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
@@ -34,14 +32,16 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import java.util.List;
+
@RunWith(Parameterized.class)
public class MapVerticesITCase extends MultipleProgramsTestBase {
- public MapVerticesITCase(TestExecutionMode mode){
+ public MapVerticesITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
+ private String expectedResult;
@Test
public void testWithSameValue() throws Exception {
@@ -49,19 +49,19 @@ public class MapVerticesITCase extends MultipleProgramsTestBase {
* Test mapVertices() keeping the same value type
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
- DataSet<Vertex<Long, Long>> mappedVertices = graph.mapVertices(new AddOneMapper()).getVertices();
- List<Vertex<Long, Long>> result= mappedVertices.collect();
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
+ DataSet<Vertex<Long, Long>> mappedVertices = graph.mapVertices(new AddOneMapper()).getVertices();
+ List<Vertex<Long, Long>> result = mappedVertices.collect();
+
expectedResult = "1,2\n" +
"2,3\n" +
"3,4\n" +
"4,5\n" +
"5,6\n";
-
+
compareResultAsTuples(result, expectedResult);
}
@@ -71,19 +71,19 @@ public class MapVerticesITCase extends MultipleProgramsTestBase {
* Test mapVertices() and change the value type to String
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Vertex<Long, String>> mappedVertices = graph.mapVertices(new ToStringMapper()).getVertices();
- List<Vertex<Long, String>> result= mappedVertices.collect();
+ List<Vertex<Long, String>> result = mappedVertices.collect();
expectedResult = "1,one\n" +
"2,two\n" +
"3,three\n" +
"4,four\n" +
"5,five\n";
-
+
compareResultAsTuples(result, expectedResult);
}
@@ -93,19 +93,19 @@ public class MapVerticesITCase extends MultipleProgramsTestBase {
* Test mapVertices() and change the value type to a Tuple1
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Vertex<Long, Tuple1<Long>>> mappedVertices = graph.mapVertices(new ToTuple1Mapper()).getVertices();
- List<Vertex<Long, Tuple1<Long>>> result= mappedVertices.collect();
+ List<Vertex<Long, Tuple1<Long>>> result = mappedVertices.collect();
expectedResult = "1,(1)\n" +
"2,(2)\n" +
"3,(3)\n" +
"4,(4)\n" +
"5,(5)\n";
-
+
compareResultAsTuples(result, expectedResult);
}
@@ -115,19 +115,19 @@ public class MapVerticesITCase extends MultipleProgramsTestBase {
* Test mapVertices() and change the value type to a custom type
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Vertex<Long, DummyCustomType>> mappedVertices = graph.mapVertices(new ToCustomTypeMapper()).getVertices();
- List<Vertex<Long, DummyCustomType>> result= mappedVertices.collect();
+ List<Vertex<Long, DummyCustomType>> result = mappedVertices.collect();
expectedResult = "1,(T,1)\n" +
"2,(T,2)\n" +
"3,(T,3)\n" +
"4,(T,4)\n" +
"5,(T,5)\n";
-
+
compareResultAsTuples(result, expectedResult);
}
@@ -137,27 +137,27 @@ public class MapVerticesITCase extends MultipleProgramsTestBase {
* Test mapVertices() and change the value type to a parameterized custom type
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
+
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
DataSet<Vertex<Long, DummyCustomParameterizedType<Double>>> mappedVertices = graph.mapVertices(
- new ToCustomParametrizedTypeMapper()).getVertices();
- List<Vertex<Long, DummyCustomParameterizedType<Double>>> result= mappedVertices.collect();
-
+ new ToCustomParametrizedTypeMapper()).getVertices();
+ List<Vertex<Long, DummyCustomParameterizedType<Double>>> result = mappedVertices.collect();
+
expectedResult = "1,(1.0,1)\n" +
"2,(2.0,2)\n" +
"3,(3.0,3)\n" +
"4,(4.0,4)\n" +
"5,(5.0,5)\n";
-
+
compareResultAsTuples(result, expectedResult);
}
@SuppressWarnings("serial")
private static final class AddOneMapper implements MapFunction<Vertex<Long, Long>, Long> {
public Long map(Vertex<Long, Long> value) throws Exception {
- return value.getValue()+1;
+ return value.getValue() + 1;
}
}
@@ -167,20 +167,15 @@ public class MapVerticesITCase extends MultipleProgramsTestBase {
String stringValue;
if (vertex.getValue() == 1) {
stringValue = "one";
- }
- else if (vertex.getValue() == 2) {
+ } else if (vertex.getValue() == 2) {
stringValue = "two";
- }
- else if (vertex.getValue() == 3) {
+ } else if (vertex.getValue() == 3) {
stringValue = "three";
- }
- else if (vertex.getValue() == 4) {
+ } else if (vertex.getValue() == 4) {
stringValue = "four";
- }
- else if (vertex.getValue() == 5) {
+ } else if (vertex.getValue() == 5) {
stringValue = "five";
- }
- else {
+ } else {
stringValue = "";
}
return stringValue;
@@ -200,19 +195,19 @@ public class MapVerticesITCase extends MultipleProgramsTestBase {
private static final class ToCustomTypeMapper implements MapFunction<Vertex<Long, Long>, DummyCustomType> {
public DummyCustomType map(Vertex<Long, Long> vertex) throws Exception {
DummyCustomType dummyValue = new DummyCustomType();
- dummyValue.setIntField(vertex.getValue().intValue());
+ dummyValue.setIntField(vertex.getValue().intValue());
return dummyValue;
}
}
@SuppressWarnings("serial")
- private static final class ToCustomParametrizedTypeMapper implements MapFunction<Vertex<Long, Long>,
+ private static final class ToCustomParametrizedTypeMapper implements MapFunction<Vertex<Long, Long>,
DummyCustomParameterizedType<Double>> {
-
+
public DummyCustomParameterizedType<Double> map(Vertex<Long, Long> vertex) throws Exception {
DummyCustomParameterizedType<Double> dummyValue = new DummyCustomParameterizedType<>();
dummyValue.setIntField(vertex.getValue().intValue());
- dummyValue.setTField(new Double(vertex.getValue()));
+ dummyValue.setTField(new Double(vertex.getValue()));
return dummyValue;
}
}
[2/6] flink git commit: [hotfix] [gelly] Improve generic type
formatting
Posted by gr...@apache.org.
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/TestGraphUtils.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/TestGraphUtils.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/TestGraphUtils.java
index 85373d3..7766723 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/TestGraphUtils.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/TestGraphUtils.java
@@ -18,11 +18,6 @@
package org.apache.flink.graph.test;
-import java.io.PrintStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.tuple.Tuple2;
@@ -30,6 +25,11 @@ import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.graph.Edge;
import org.apache.flink.graph.Vertex;
+import java.io.PrintStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
public class TestGraphUtils {
public static DataSet<Vertex<Long, Long>> getLongLongVertexData(
@@ -354,20 +354,20 @@ public class TestGraphUtils {
* utils for getting the second graph for the test of method difference();
* @param env - ExecutionEnvironment
*/
- public static DataSet<Edge<Long,Long>> getLongLongEdgeDataDifference(ExecutionEnvironment env) {
+ public static DataSet<Edge<Long, Long>> getLongLongEdgeDataDifference(ExecutionEnvironment env) {
return env.fromCollection(getLongLongEdgesForDifference());
}
- public static DataSet<Edge<Long,Long>> getLongLongEdgeDataDifference2(ExecutionEnvironment env) {
+ public static DataSet<Edge<Long, Long>> getLongLongEdgeDataDifference2(ExecutionEnvironment env) {
return env.fromCollection(getLongLongEdgesForDifference2());
}
- public static DataSet<Vertex<Long,Long>> getLongLongVertexDataDifference(ExecutionEnvironment env) {
+ public static DataSet<Vertex<Long, Long>> getLongLongVertexDataDifference(ExecutionEnvironment env) {
return env.fromCollection(getVerticesForDifference());
}
- public static List<Vertex<Long,Long>> getVerticesForDifference(){
- List<Vertex<Long,Long>> vertices = new ArrayList<>();
+ public static List<Vertex<Long, Long>> getVerticesForDifference(){
+ List<Vertex<Long, Long>> vertices = new ArrayList<>();
vertices.add(new Vertex<>(1L, 1L));
vertices.add(new Vertex<>(3L, 3L));
vertices.add(new Vertex<>(6L, 6L));
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
index 5a64dd7..59f416f 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
@@ -18,7 +18,6 @@
package org.apache.flink.graph.test.operations;
-import java.util.List;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
@@ -32,6 +31,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import java.util.List;
+
@RunWith(Parameterized.class)
public class FromCollectionITCase extends MultipleProgramsTestBase {
@@ -51,7 +52,7 @@ public class FromCollectionITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
TestGraphUtils.getLongLongEdges(), env);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -75,8 +76,8 @@ public class FromCollectionITCase extends MultipleProgramsTestBase {
env);
- DataSet<Vertex<Long,NullValue>> data = graph.getVertices();
- List<Vertex<Long,NullValue>> result= data.collect();
+ DataSet<Vertex<Long, NullValue>> data = graph.getVertices();
+ List<Vertex<Long, NullValue>> result= data.collect();
expectedResult = "1,(null)\n" +
"2,(null)\n" +
@@ -97,8 +98,8 @@ public class FromCollectionITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongEdges(),
new InitVerticesMapper(), env);
- DataSet<Vertex<Long,Long>> data = graph.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = graph.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,2\n" +
"2,4\n" +
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
index 9995bad..10db9be 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
@@ -18,9 +18,6 @@
package org.apache.flink.graph.test.operations;
-import java.util.LinkedList;
-import java.util.List;
-
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
@@ -37,6 +34,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import java.util.LinkedList;
+import java.util.List;
+
@RunWith(Parameterized.class)
public class GraphCreationITCase extends MultipleProgramsTestBase {
@@ -55,8 +55,8 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, NullValue, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Vertex<Long,NullValue>> data = graph.getVertices();
- List<Vertex<Long,NullValue>> result= data.collect();
+ DataSet<Vertex<Long, NullValue>> data = graph.getVertices();
+ List<Vertex<Long, NullValue>> result= data.collect();
expectedResult = "1,(null)\n" +
"2,(null)\n" +
@@ -76,8 +76,8 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongEdgeData(env),
new AssignIdAsValueMapper(), env);
- DataSet<Vertex<Long,Long>> data = graph.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = graph.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -97,8 +97,8 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
Graph<Long, DummyCustomParameterizedType<Double>, Long> graph = Graph.fromDataSet(
TestGraphUtils.getLongLongEdgeData(env), new AssignCustomVertexValueMapper(), env);
- DataSet<Vertex<Long,DummyCustomParameterizedType<Double>>> data = graph.getVertices();
- List<Vertex<Long,DummyCustomParameterizedType<Double>>> result= data.collect();
+ DataSet<Vertex<Long, DummyCustomParameterizedType<Double>>> data = graph.getVertices();
+ List<Vertex<Long, DummyCustomParameterizedType<Double>>> result= data.collect();
expectedResult = "1,(2.0,0)\n" +
"2,(4.0,1)\n" +
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithCsvITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithCsvITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithCsvITCase.java
index 3ccdef0..812f418 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithCsvITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithCsvITCase.java
@@ -52,16 +52,16 @@ public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
* Test with two Csv files one with Vertex Data and one with Edges data
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- final String fileContent = "1,1\n"+
+ final String fileContent = "1,1\n"+
"2,2\n"+
"3,3\n";
final FileInputSplit split = createTempFile(fileContent);
- final String fileContent2 = "1,2,ot\n"+
+ final String fileContent2 = "1,2,ot\n"+
"3,2,tt\n"+
"3,1,to\n";
final FileInputSplit split2 = createTempFile(fileContent2);
- Graph<Long, Long, String> graph = Graph.fromCsvReader(split.getPath().toString(),split2.getPath().toString(),env)
+ Graph<Long, Long, String> graph = Graph.fromCsvReader(split.getPath().toString(), split2.getPath().toString(), env)
.types(Long.class, Long.class, String.class);
List<Triplet<Long, Long, String>> result = graph.getTriplets().collect();
@@ -106,7 +106,7 @@ public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
*Test fromCsvReader with edge path and a mapper that assigns a Double constant as value
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- final String fileContent = "1,2,ot\n"+
+ final String fileContent = "1,2,ot\n"+
"3,2,tt\n"+
"3,1,to\n";
final FileInputSplit split = createTempFile(fileContent);
@@ -126,7 +126,7 @@ public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
* Test with one Csv file one with Edges data. Also tests the configuration method ignoreFistLineEdges()
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- final String fileContent2 = "header\n1,2,ot\n"+
+ final String fileContent2 = "header\n1,2,ot\n"+
"3,2,tt\n"+
"3,1,to\n";
@@ -153,19 +153,19 @@ public class GraphCreationWithCsvITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- final String fileContent = "header\n1;1\n"+
+ final String fileContent = "header\n1;1\n"+
"2;2\n"+
"3;3\n";
final FileInputSplit split = createTempFile(fileContent);
- final String fileContent2 = "header|1:2:ot|"+
+ final String fileContent2 = "header|1:2:ot|"+
"3:2:tt|"+
"3:1:to|";
final FileInputSplit split2 = createTempFile(fileContent2);
- Graph<Long, Long, String> graph= Graph.fromCsvReader(split.getPath().toString(),split2.getPath().toString(),env).
+ Graph<Long, Long, String> graph= Graph.fromCsvReader(split.getPath().toString(), split2.getPath().toString(), env).
ignoreFirstLineEdges().ignoreFirstLineVertices().
fieldDelimiterEdges(":").fieldDelimiterVertices(";").
lineDelimiterEdges("|").
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
index c78e6ba..f8eb874 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
@@ -18,8 +18,6 @@
package org.apache.flink.graph.test.operations;
-import java.util.List;
-
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
@@ -33,6 +31,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import java.util.List;
+
@RunWith(Parameterized.class)
public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
@@ -52,8 +52,8 @@ public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
Graph<Long, Double, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongEdgeData(env),
new AssignDoubleValueMapper(), env);
- DataSet<Vertex<Long,Double>> data = graph.getVertices();
- List<Vertex<Long,Double>> result= data.collect();
+ DataSet<Vertex<Long, Double>> data = graph.getVertices();
+ List<Vertex<Long, Double>> result= data.collect();
expectedResult = "1,0.1\n" +
"2,0.1\n" +
@@ -95,8 +95,8 @@ public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
Graph<String, Double, Long> graph = Graph.fromDataSet(TestGraphUtils.getStringLongEdgeData(env),
new AssignDoubleConstantMapper(), env);
- DataSet<Vertex<String,Double>> data = graph.getVertices();
- List<Vertex<String,Double>> result= data.collect();
+ DataSet<Vertex<String, Double>> data = graph.getVertices();
+ List<Vertex<String, Double>> result= data.collect();
expectedResult = "1,0.1\n" +
"2,0.1\n" +
@@ -116,8 +116,8 @@ public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
Graph<Long, DummyCustomType, Long> graph = Graph.fromDataSet(
TestGraphUtils.getLongLongEdgeData(env), new AssignCustomValueMapper(), env);
- DataSet<Vertex<Long,DummyCustomType>> data = graph.getVertices();
- List<Vertex<Long,DummyCustomType>> result= data.collect();
+ DataSet<Vertex<Long, DummyCustomType>> data = graph.getVertices();
+ List<Vertex<Long, DummyCustomType>> result= data.collect();
expectedResult = "1,(F,0)\n" +
"2,(F,1)\n" +
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java
index b513ff8..c72750e 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphMutationsITCase.java
@@ -18,9 +18,6 @@
package org.apache.flink.graph.test.operations;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.graph.Edge;
@@ -32,6 +29,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import java.util.ArrayList;
+import java.util.List;
+
@RunWith(Parameterized.class)
public class GraphMutationsITCase extends MultipleProgramsTestBase {
@@ -54,8 +54,8 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addVertex(new Vertex<>(6L, 6L));
- DataSet<Vertex<Long,Long>> data = graph.getVertices();
- List<Vertex<Long,Long>> result = data.collect();
+ DataSet<Vertex<Long, Long>> data = graph.getVertices();
+ List<Vertex<Long, Long>> result = data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -87,8 +87,8 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addVertices(vertices);
- DataSet<Vertex<Long,Long>> data = graph.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = graph.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -113,8 +113,8 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addVertex(new Vertex<>(1L, 1L));
- DataSet<Vertex<Long,Long>> data = graph.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = graph.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -142,8 +142,8 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addVertices(vertices);
- DataSet<Vertex<Long,Long>> data = graph.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = graph.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -171,8 +171,8 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addVertices(vertices);
- DataSet<Vertex<Long,Long>> data = graph.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = graph.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,1\n" +
"2,2\n" +
@@ -196,7 +196,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
TestGraphUtils.getLongLongEdgeData(env), env);
graph = graph.removeVertex(new Vertex<>(5L, 5L));
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -224,7 +224,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeVertices(verticesToBeRemoved);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "3,4,34\n" +
@@ -246,7 +246,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
TestGraphUtils.getLongLongEdgeData(env), env);
graph = graph.removeVertex(new Vertex<>(6L, 6L));
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -276,7 +276,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeVertices(verticesToBeRemoved);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "2,3,23\n" +
@@ -303,7 +303,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeVertices(verticesToBeRemoved);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -333,7 +333,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeVertices(verticesToBeRemoved);
- DataSet<Vertex<Long,Long>> data = graph.getVertices();
+ DataSet<Vertex<Long, Long>> data = graph.getVertices();
List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,1\n" +
@@ -357,7 +357,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
TestGraphUtils.getLongLongEdgeData(env), env);
graph = graph.addEdge(new Vertex<>(6L, 6L), new Vertex<>(1L, 1L), 61L);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -389,7 +389,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addEdges(edgesToBeAdded);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -422,7 +422,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addEdges(edgesToBeAdded);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -449,7 +449,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.addEdge(new Vertex<>(1L, 1L), new Vertex<>(2L, 2L),
12L);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -480,7 +480,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeEdge(new Edge<>(5L, 1L, 51L));
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -513,7 +513,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeEdges(edgesToBeRemoved);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -542,7 +542,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeEdges(edgesToBeRemoved);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -567,7 +567,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
TestGraphUtils.getLongLongEdgeData(env), env);
graph = graph.removeEdge(new Edge<>(6L, 1L, 61L));
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -597,7 +597,7 @@ public class GraphMutationsITCase extends MultipleProgramsTestBase {
graph = graph.removeEdges(edgesToBeRemoved);
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
index 3f03267..4d7153d 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphOperationsITCase.java
@@ -56,7 +56,7 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Edge<Long,Long>> data = graph.getUndirected().getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getUndirected().getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" + "2,1,12\n" +
@@ -80,7 +80,7 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Edge<Long,Long>> data = graph.reverse().getEdges();
+ DataSet<Edge<Long, Long>> data = graph.reverse().getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "2,1,12\n" +
@@ -105,7 +105,7 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Edge<Long,Long>> data= graph.subgraph(new FilterFunction<Vertex<Long, Long>>() {
+ DataSet<Edge<Long, Long>> data= graph.subgraph(new FilterFunction<Vertex<Long, Long>>() {
public boolean filter(Vertex<Long, Long> vertex) throws Exception {
return (vertex.getValue() > 2);
}
@@ -135,7 +135,7 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Edge<Long,Long>> data = graph.filterOnVertices(new FilterFunction<Vertex<Long, Long>>() {
+ DataSet<Edge<Long, Long>> data = graph.filterOnVertices(new FilterFunction<Vertex<Long, Long>>() {
public boolean filter(Vertex<Long, Long> vertex) throws Exception {
return (vertex.getValue() > 2);
}
@@ -161,7 +161,7 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Edge<Long,Long>> data = graph.filterOnEdges(new FilterFunction<Edge<Long, Long>>() {
+ DataSet<Edge<Long, Long>> data = graph.filterOnEdges(new FilterFunction<Edge<Long, Long>>() {
public boolean filter(Edge<Long, Long> edge) throws Exception {
return (edge.getValue() > 34);
}
@@ -240,7 +240,7 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Tuple2<Long,Long>> data = graph.getEdgeIds();
+ DataSet<Tuple2<Long, Long>> data = graph.getEdgeIds();
List<Tuple2<Long, Long>> result= data.collect();
expectedResult = "1,2\n" + "1,3\n" +
@@ -269,7 +269,7 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
graph = graph.union(Graph.fromCollection(vertices, edges, env));
- DataSet<Edge<Long,Long>> data = graph.getEdges();
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,12\n" +
@@ -339,7 +339,7 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
DataSet<Vertex<Long, Long>> vertex = env.fromElements(new Vertex<>(6L, 6L));
- Graph<Long, Long, Long> graph2 = Graph.fromDataSet(vertex,TestGraphUtils.getLongLongEdgeDataDifference2(env),env);
+ Graph<Long, Long, Long> graph2 = Graph.fromDataSet(vertex, TestGraphUtils.getLongLongEdgeDataDifference2(env), env);
graph = graph.difference(graph2);
@@ -446,8 +446,8 @@ public class GraphOperationsITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Triplet<Long,Long,Long>> data = graph.getTriplets();
- List<Triplet<Long,Long,Long>> result= data.collect();
+ DataSet<Triplet<Long, Long, Long>> data = graph.getTriplets();
+ List<Triplet<Long, Long, Long>> result= data.collect();
expectedResult = "1,2,1,2,12\n" + "1,3,1,3,13\n" +
"2,3,2,3,23\n" + "3,4,3,4,34\n" +
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
index 2fa3b8c..cb83b33 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithEdgesITCase.java
@@ -18,8 +18,6 @@
package org.apache.flink.graph.test.operations;
-import java.util.List;
-
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
@@ -36,6 +34,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import java.util.List;
+
@RunWith(Parameterized.class)
public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
@@ -59,7 +59,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdges(graph.getEdges()
.map(new EdgeToTuple3Map<Long, Long>()), new AddValuesMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,24\n" +
@@ -87,7 +87,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdges(graph.getEdges().first(3)
.map(new EdgeToTuple3Map<Long, Long>()), new AddValuesMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,24\n" +
@@ -115,7 +115,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdges(graph.getEdges().first(3)
.map(new BooleanEdgeValueMapper()), new DoubleIfTrueMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,24\n" +
@@ -143,7 +143,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdges(TestGraphUtils.getLongLongLongTuple3Data(env),
new DoubleValueMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,24\n" +
@@ -170,7 +170,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdges(TestGraphUtils.getLongLongCustomTuple3Data(env),
new CustomValueMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,10\n" +
@@ -198,7 +198,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(graph.getEdges()
.map(new ProjectSourceAndValueMapper()), new AddValuesMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,24\n" +
@@ -226,7 +226,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(graph.getEdges().first(3)
.map(new ProjectSourceAndValueMapper()), new AddValuesMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,24\n" +
@@ -254,7 +254,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(graph.getEdges().first(3)
.map(new ProjectSourceWithTrueMapper()), new DoubleIfTrueMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,24\n" +
@@ -282,7 +282,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(TestGraphUtils.getLongLongTuple2SourceData(env),
new DoubleValueMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,20\n" +
@@ -309,7 +309,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdgesOnSource(TestGraphUtils.getLongCustomTuple2SourceData(env),
new CustomValueMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,10\n" +
@@ -337,7 +337,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(graph.getEdges()
.map(new ProjectTargetAndValueMapper()), new AddValuesMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,24\n" +
@@ -365,7 +365,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(graph.getEdges().first(3)
.map(new ProjectTargetAndValueMapper()), new AddValuesMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,24\n" +
@@ -393,7 +393,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(graph.getEdges().first(3)
.map(new ProjectTargetWithTrueMapper()), new DoubleIfTrueMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,24\n" +
@@ -421,7 +421,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(TestGraphUtils.getLongLongTuple2TargetData(env),
new DoubleValueMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,20\n" +
@@ -448,7 +448,7 @@ public class JoinWithEdgesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithEdgesOnTarget(TestGraphUtils.getLongCustomTuple2TargetData(env),
new CustomValueMapper());
- DataSet<Edge<Long,Long>> data = res.getEdges();
+ DataSet<Edge<Long, Long>> data = res.getEdges();
List<Edge<Long, Long>> result= data.collect();
expectedResult = "1,2,10\n" +
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
index 5b77101..29badba 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/JoinWithVerticesITCase.java
@@ -18,8 +18,6 @@
package org.apache.flink.graph.test.operations;
-import java.util.List;
-
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
@@ -35,6 +33,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import java.util.List;
+
@RunWith(Parameterized.class)
public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
@@ -58,8 +58,8 @@ public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithVertices(graph.getVertices()
.map(new VertexToTuple2Map<Long, Long>()), new AddValuesMapper());
- DataSet<Vertex<Long,Long>> data = res.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = res.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,2\n" +
"2,4\n" +
@@ -84,8 +84,8 @@ public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithVertices(graph.getVertices().first(3)
.map(new VertexToTuple2Map<Long, Long>()), new AddValuesMapper());
- DataSet<Vertex<Long,Long>> data = res.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = res.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,2\n" +
"2,4\n" +
@@ -110,8 +110,8 @@ public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithVertices(graph.getVertices().first(3)
.map(new ProjectIdWithTrue()), new DoubleIfTrueMapper());
- DataSet<Vertex<Long,Long>> data = res.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = res.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,2\n" +
"2,4\n" +
@@ -136,8 +136,8 @@ public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithVertices(TestGraphUtils.getLongLongTuple2Data(env),
new ProjectSecondMapper());
- DataSet<Vertex<Long,Long>> data = res.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = res.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,10\n" +
"2,20\n" +
@@ -161,8 +161,8 @@ public class JoinWithVerticesITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> res = graph.joinWithVertices(TestGraphUtils.getLongCustomTuple2Data(env),
new CustomValueMapper());
- DataSet<Vertex<Long,Long>> data = res.getVertices();
- List<Vertex<Long,Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = res.getVertices();
+ List<Vertex<Long, Long>> result= data.collect();
expectedResult = "1,10\n" +
"2,20\n" +
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
index 3978d36..84d7722 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnEdgesMethodsITCase.java
@@ -18,9 +18,6 @@
package org.apache.flink.graph.test.operations;
-import java.util.List;
-import java.util.Objects;
-
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.tuple.Tuple2;
@@ -38,6 +35,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import java.util.List;
+import java.util.Objects;
+
@RunWith(Parameterized.class)
public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
@@ -59,7 +59,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
graph.groupReduceOnEdges(new SelectMinWeightNeighbor(), EdgeDirection.OUT);
- List<Tuple2<Long,Long>> result = verticesWithLowestOutNeighbor.collect();
+ List<Tuple2<Long, Long>> result = verticesWithLowestOutNeighbor.collect();
expectedResult = "1,2\n" +
@@ -83,7 +83,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
graph.groupReduceOnEdges(new SelectMinWeightInNeighbor(), EdgeDirection.IN);
- List<Tuple2<Long,Long>> result = verticesWithLowestOutNeighbor.collect();
+ List<Tuple2<Long, Long>> result = verticesWithLowestOutNeighbor.collect();
expectedResult = "1,5\n" +
"2,1\n" +
@@ -105,7 +105,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithAllOutNeighbors =
graph.groupReduceOnEdges(new SelectOutNeighbors(), EdgeDirection.OUT);
- List<Tuple2<Long,Long>> result = verticesWithAllOutNeighbors.collect();
+ List<Tuple2<Long, Long>> result = verticesWithAllOutNeighbors.collect();
expectedResult = "1,2\n" +
"1,3\n" +
@@ -129,7 +129,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithAllOutNeighbors =
graph.groupReduceOnEdges(new SelectOutNeighborsExcludeFive(), EdgeDirection.OUT);
- List<Tuple2<Long,Long>> result = verticesWithAllOutNeighbors.collect();
+ List<Tuple2<Long, Long>> result = verticesWithAllOutNeighbors.collect();
expectedResult = "1,2\n" +
"1,3\n" +
@@ -152,7 +152,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithAllOutNeighbors =
graph.groupReduceOnEdges(new SelectOutNeighborsValueGreaterThanTwo(), EdgeDirection.OUT);
- List<Tuple2<Long,Long>> result = verticesWithAllOutNeighbors.collect();
+ List<Tuple2<Long, Long>> result = verticesWithAllOutNeighbors.collect();
expectedResult = "3,4\n" +
"3,5\n" +
@@ -173,7 +173,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithAllInNeighbors =
graph.groupReduceOnEdges(new SelectInNeighbors(), EdgeDirection.IN);
- List<Tuple2<Long,Long>> result = verticesWithAllInNeighbors.collect();
+ List<Tuple2<Long, Long>> result = verticesWithAllInNeighbors.collect();
expectedResult = "1,5\n" +
"2,1\n" +
@@ -197,7 +197,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithAllInNeighbors =
graph.groupReduceOnEdges(new SelectInNeighborsExceptFive(), EdgeDirection.IN);
- List<Tuple2<Long,Long>> result = verticesWithAllInNeighbors.collect();
+ List<Tuple2<Long, Long>> result = verticesWithAllInNeighbors.collect();
expectedResult = "1,5\n" +
"2,1\n" +
@@ -219,7 +219,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithAllInNeighbors =
graph.groupReduceOnEdges(new SelectInNeighborsValueGreaterThanTwo(), EdgeDirection.IN);
- List<Tuple2<Long,Long>> result = verticesWithAllInNeighbors.collect();
+ List<Tuple2<Long, Long>> result = verticesWithAllInNeighbors.collect();
expectedResult = "3,1\n" +
"3,2\n" +
@@ -241,7 +241,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithAllNeighbors =
graph.groupReduceOnEdges(new SelectNeighbors(), EdgeDirection.ALL);
- List<Tuple2<Long,Long>> result = verticesWithAllNeighbors.collect();
+ List<Tuple2<Long, Long>> result = verticesWithAllNeighbors.collect();
expectedResult = "1,2\n" +
"1,3\n" +
@@ -272,7 +272,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithAllNeighbors =
graph.groupReduceOnEdges(new SelectNeighborsExceptFiveAndTwo(), EdgeDirection.ALL);
- List<Tuple2<Long,Long>> result = verticesWithAllNeighbors.collect();
+ List<Tuple2<Long, Long>> result = verticesWithAllNeighbors.collect();
expectedResult = "1,2\n" +
"1,3\n" +
@@ -298,7 +298,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithAllNeighbors =
graph.groupReduceOnEdges(new SelectNeighborsValueGreaterThanFour(), EdgeDirection.ALL);
- List<Tuple2<Long,Long>> result = verticesWithAllNeighbors.collect();
+ List<Tuple2<Long, Long>> result = verticesWithAllNeighbors.collect();
expectedResult = "5,1\n" +
"5,3\n" +
@@ -319,7 +319,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithMaxEdgeWeight =
graph.groupReduceOnEdges(new SelectMaxWeightNeighbor(), EdgeDirection.ALL);
- List<Tuple2<Long,Long>> result = verticesWithMaxEdgeWeight.collect();
+ List<Tuple2<Long, Long>> result = verticesWithMaxEdgeWeight.collect();
expectedResult = "1,51\n" +
"2,23\n" +
@@ -342,7 +342,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
graph.reduceOnEdges(new SelectMinWeightNeighborNoValue(), EdgeDirection.OUT);
- List<Tuple2<Long,Long>> result = verticesWithLowestOutNeighbor.collect();
+ List<Tuple2<Long, Long>> result = verticesWithLowestOutNeighbor.collect();
expectedResult = "1,12\n" +
"2,23\n" +
@@ -365,7 +365,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithLowestOutNeighbor =
graph.reduceOnEdges(new SelectMinWeightNeighborNoValue(), EdgeDirection.IN);
- List<Tuple2<Long,Long>> result = verticesWithLowestOutNeighbor.collect();
+ List<Tuple2<Long, Long>> result = verticesWithLowestOutNeighbor.collect();
expectedResult = "1,51\n" +
"2,12\n" +
@@ -388,7 +388,7 @@ public class ReduceOnEdgesMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithMaxEdgeWeight =
graph.reduceOnEdges(new SelectMaxWeightNeighborNoValue(), EdgeDirection.ALL);
- List<Tuple2<Long,Long>> result = verticesWithMaxEdgeWeight.collect();
+ List<Tuple2<Long, Long>> result = verticesWithMaxEdgeWeight.collect();
expectedResult = "1,51\n" +
"2,23\n" +
http://git-wip-us.apache.org/repos/asf/flink/blob/53716a4d/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
index cc5d91d..a352bb4 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/ReduceOnNeighborMethodsITCase.java
@@ -59,7 +59,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
graph.groupReduceOnNeighbors(new SumOutNeighbors(), EdgeDirection.OUT);
- List<Tuple2<Long,Long>> result = verticesWithSumOfOutNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "1,5\n" +
"2,3\n" +
@@ -82,7 +82,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSum =
graph.groupReduceOnNeighbors(new SumInNeighbors(), EdgeDirection.IN);
- List<Tuple2<Long,Long>> result = verticesWithSum.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSum.collect();
expectedResult = "1,255\n" +
"2,12\n" +
@@ -108,7 +108,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
graph.groupReduceOnNeighbors(new SumAllNeighbors(), EdgeDirection.ALL);
- List<Tuple2<Long,Long>> result = verticesWithSumOfOutNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "1,11\n" +
"2,6\n" +
@@ -131,7 +131,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
graph.groupReduceOnNeighbors(new SumOutNeighborsIdGreaterThanThree(), EdgeDirection.OUT);
- List<Tuple2<Long,Long>> result = verticesWithSumOfOutNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "4,5\n" +
"5,1\n";
@@ -151,7 +151,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSum =
graph.groupReduceOnNeighbors(new SumInNeighborsIdGreaterThanThree(), EdgeDirection.IN);
- List<Tuple2<Long,Long>> result = verticesWithSum.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSum.collect();
expectedResult = "4,102\n" +
"5,285\n";
@@ -172,7 +172,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
graph.groupReduceOnNeighbors(new SumAllNeighborsIdGreaterThanThree(), EdgeDirection.ALL);
- List<Tuple2<Long,Long>> result = verticesWithSumOfOutNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "4,12\n" +
"5,13\n";
@@ -192,7 +192,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
graph.reduceOnNeighbors(new SumNeighbors(), EdgeDirection.OUT);
- List<Tuple2<Long,Long>> result = verticesWithSumOfOutNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "1,5\n" +
"2,3\n" +
@@ -215,7 +215,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSum =
graph.groupReduceOnNeighbors(new SumInNeighborsNoValue(), EdgeDirection.IN);
- List<Tuple2<Long,Long>> result = verticesWithSum.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSum.collect();
expectedResult = "1,255\n" +
"2,12\n" +
@@ -238,7 +238,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfAllNeighborValues =
graph.reduceOnNeighbors(new SumNeighbors(), EdgeDirection.ALL);
- List<Tuple2<Long,Long>> result = verticesWithSumOfAllNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfAllNeighborValues.collect();
expectedResult = "1,10\n" +
"2,4\n" +
@@ -261,7 +261,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
graph.groupReduceOnNeighbors(new SumOutNeighborsNoValueMultipliedByTwoIdGreaterThanTwo(), EdgeDirection.OUT);
- List<Tuple2<Long,Long>> result = verticesWithSumOfOutNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "3,9\n" +
"3,18\n" +
@@ -285,7 +285,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
graph.groupReduceOnNeighbors(new SumInNeighborsNoValueMultipliedByTwoIdGreaterThanTwo(), EdgeDirection.IN);
- List<Tuple2<Long,Long>> result = verticesWithSumOfOutNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "3,59\n" +
"3,118\n" +
@@ -309,7 +309,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfAllNeighborValues =
graph.groupReduceOnNeighbors(new SumAllNeighborsNoValueMultipliedByTwoIdGreaterThanTwo(), EdgeDirection.ALL);
- List<Tuple2<Long,Long>> result = verticesWithSumOfAllNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfAllNeighborValues.collect();
expectedResult = "3,12\n" +
"3,24\n" +
@@ -333,7 +333,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
graph.groupReduceOnNeighbors(new SumOutNeighborsMultipliedByTwo(), EdgeDirection.OUT);
- List<Tuple2<Long,Long>> result = verticesWithSumOfOutNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "1,5\n" +
"1,10\n" +
@@ -361,7 +361,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSum =
graph.groupReduceOnNeighbors(new SumInNeighborsSubtractOne(), EdgeDirection.IN);
- List<Tuple2<Long,Long>> result = verticesWithSum.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSum.collect();
expectedResult = "1,255\n" +
"1,254\n" +
@@ -390,7 +390,7 @@ public class ReduceOnNeighborMethodsITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> verticesWithSumOfOutNeighborValues =
graph.groupReduceOnNeighbors(new SumAllNeighborsAddFive(), EdgeDirection.ALL);
- List<Tuple2<Long,Long>> result = verticesWithSumOfOutNeighborValues.collect();
+ List<Tuple2<Long, Long>> result = verticesWithSumOfOutNeighborValues.collect();
expectedResult = "1,11\n" +
"1,16\n" +
[6/6] flink git commit: [hotfix] [gelly] Indent Java with tabs not
spaces
Posted by gr...@apache.org.
[hotfix] [gelly] Indent Java with tabs not spaces
This PR also applies IntelliJ's "reformat code" using the unofficial
Flink-style configuration.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/cb282067
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/cb282067
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/cb282067
Branch: refs/heads/master
Commit: cb282067517ed721858e5c898abbbf59a2fbafef
Parents: 53716a4
Author: Greg Hogan <co...@greghogan.com>
Authored: Tue Jan 17 15:01:17 2017 -0500
Committer: Greg Hogan <co...@greghogan.com>
Committed: Tue Jan 17 15:38:25 2017 -0500
----------------------------------------------------------------------
.../graph/library/CommunityDetectionITCase.java | 14 +-
.../graph/library/LabelPropagationITCase.java | 16 +-
.../flink/graph/library/PageRankITCase.java | 50 +-
.../flink/graph/test/GatherSumApplyITCase.java | 32 +-
.../SingleSourceShortestPathsITCase.java | 94 +--
.../test/GatherSumApplyConfigurationITCase.java | 90 ++-
.../test/ScatterGatherConfigurationITCase.java | 262 ++++----
.../graph/test/operations/DegreesITCase.java | 201 ++++---
.../test/operations/FromCollectionITCase.java | 109 ++--
.../test/operations/GraphCreationITCase.java | 143 ++---
.../GraphCreationWithMapperITCase.java | 85 ++-
.../test/operations/GraphOperationsITCase.java | 235 ++++----
.../test/operations/JoinWithEdgesITCase.java | 593 +++++++++----------
.../test/operations/JoinWithVerticesITCase.java | 185 +++---
.../graph/test/operations/MapEdgesITCase.java | 118 ++--
.../test/operations/MapVerticesITCase.java | 91 ++-
.../operations/ReduceOnEdgesMethodsITCase.java | 345 +++++------
.../ReduceOnNeighborMethodsITCase.java | 388 ++++++------
18 files changed, 1511 insertions(+), 1540 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/CommunityDetectionITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/CommunityDetectionITCase.java b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/CommunityDetectionITCase.java
index cd8af9b..c37d1ed 100644
--- a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/CommunityDetectionITCase.java
+++ b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/CommunityDetectionITCase.java
@@ -47,10 +47,10 @@ public class CommunityDetectionITCase extends MultipleProgramsTestBase {
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Double> inputGraph = Graph.fromDataSet(
- CommunityDetectionData.getSimpleEdgeDataSet(env), new InitLabels(), env);
+ CommunityDetectionData.getSimpleEdgeDataSet(env), new InitLabels(), env);
- List<Vertex<Long, Long>> result = inputGraph.run(new CommunityDetection<Long>(1, CommunityDetectionData.DELTA))
- .getVertices().collect();
+ List<Vertex<Long, Long>> result = inputGraph.run(new CommunityDetection<Long>(1, CommunityDetectionData.DELTA))
+ .getVertices().collect();
expected = CommunityDetectionData.COMMUNITIES_SINGLE_ITERATION;
compareResultAsTuples(result, expected);
@@ -63,16 +63,16 @@ public class CommunityDetectionITCase extends MultipleProgramsTestBase {
*/
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Double> inputGraph = Graph.fromDataSet(
- CommunityDetectionData.getTieEdgeDataSet(env), new InitLabels(), env);
+ CommunityDetectionData.getTieEdgeDataSet(env), new InitLabels(), env);
- List<Vertex<Long, Long>> result = inputGraph.run(new CommunityDetection<Long>(1, CommunityDetectionData.DELTA))
- .getVertices().collect();
+ List<Vertex<Long, Long>> result = inputGraph.run(new CommunityDetection<Long>(1, CommunityDetectionData.DELTA))
+ .getVertices().collect();
expected = CommunityDetectionData.COMMUNITIES_WITH_TIE;
compareResultAsTuples(result, expected);
}
@SuppressWarnings("serial")
- private static final class InitLabels implements MapFunction<Long, Long>{
+ private static final class InitLabels implements MapFunction<Long, Long> {
public Long map(Long id) {
return id;
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/LabelPropagationITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/LabelPropagationITCase.java b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/LabelPropagationITCase.java
index 8b9234b..e6ba794 100644
--- a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/LabelPropagationITCase.java
+++ b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/LabelPropagationITCase.java
@@ -33,11 +33,11 @@ import java.util.List;
@RunWith(Parameterized.class)
public class LabelPropagationITCase extends MultipleProgramsTestBase {
- public LabelPropagationITCase(TestExecutionMode mode){
+ public LabelPropagationITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
+ private String expectedResult;
@Test
public void testSingleIteration() throws Exception {
@@ -47,10 +47,10 @@ public class LabelPropagationITCase extends MultipleProgramsTestBase {
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, NullValue> inputGraph = Graph.fromDataSet(
- LabelPropagationData.getDefaultVertexSet(env),
- LabelPropagationData.getDefaultEdgeDataSet(env), env);
+ LabelPropagationData.getDefaultVertexSet(env),
+ LabelPropagationData.getDefaultEdgeDataSet(env), env);
- List<Vertex<Long, Long>> result = inputGraph
+ List<Vertex<Long, Long>> result = inputGraph
.run(new LabelPropagation<Long, Long, NullValue>(1))
.collect();
@@ -66,10 +66,10 @@ public class LabelPropagationITCase extends MultipleProgramsTestBase {
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, NullValue> inputGraph = Graph.fromDataSet(
- LabelPropagationData.getTieVertexSet(env),
- LabelPropagationData.getTieEdgeDataSet(env), env);
+ LabelPropagationData.getTieVertexSet(env),
+ LabelPropagationData.getTieEdgeDataSet(env), env);
- List<Vertex<Long, Long>> result = inputGraph
+ List<Vertex<Long, Long>> result = inputGraph
.run(new LabelPropagation<Long, Long, NullValue>(1))
.collect();
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/PageRankITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/PageRankITCase.java b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/PageRankITCase.java
index e3e8f08..25a3e3f 100644
--- a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/PageRankITCase.java
+++ b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/library/PageRankITCase.java
@@ -35,7 +35,7 @@ import java.util.List;
@RunWith(Parameterized.class)
public class PageRankITCase extends MultipleProgramsTestBase {
- public PageRankITCase(TestExecutionMode mode){
+ public PageRankITCase(TestExecutionMode mode) {
super(mode);
}
@@ -44,12 +44,12 @@ public class PageRankITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Double, Double> inputGraph = Graph.fromDataSet(
- PageRankData.getDefaultEdgeDataSet(env), new InitMapper(), env);
+ PageRankData.getDefaultEdgeDataSet(env), new InitMapper(), env);
- List<Vertex<Long, Double>> result = inputGraph.run(new PageRank<Long>(0.85, 3))
- .collect();
-
- compareWithDelta(result, 0.01);
+ List<Vertex<Long, Double>> result = inputGraph.run(new PageRank<Long>(0.85, 3))
+ .collect();
+
+ compareWithDelta(result, 0.01);
}
@Test
@@ -57,12 +57,12 @@ public class PageRankITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Double, Double> inputGraph = Graph.fromDataSet(
- PageRankData.getDefaultEdgeDataSet(env), new InitMapper(), env);
+ PageRankData.getDefaultEdgeDataSet(env), new InitMapper(), env);
+
+ List<Vertex<Long, Double>> result = inputGraph.run(new GSAPageRank<Long>(0.85, 3))
+ .collect();
- List<Vertex<Long, Double>> result = inputGraph.run(new GSAPageRank<Long>(0.85, 3))
- .collect();
-
- compareWithDelta(result, 0.01);
+ compareWithDelta(result, 0.01);
}
@Test
@@ -70,12 +70,12 @@ public class PageRankITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Double, Double> inputGraph = Graph.fromDataSet(
- PageRankData.getDefaultEdgeDataSet(env), new InitMapper(), env);
+ PageRankData.getDefaultEdgeDataSet(env), new InitMapper(), env);
- List<Vertex<Long, Double>> result = inputGraph.run(new PageRank<Long>(0.85, 3))
- .collect();
+ List<Vertex<Long, Double>> result = inputGraph.run(new PageRank<Long>(0.85, 3))
+ .collect();
- compareWithDelta(result, 0.01);
+ compareWithDelta(result, 0.01);
}
@Test
@@ -83,20 +83,20 @@ public class PageRankITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Double, Double> inputGraph = Graph.fromDataSet(
- PageRankData.getDefaultEdgeDataSet(env), new InitMapper(), env);
+ PageRankData.getDefaultEdgeDataSet(env), new InitMapper(), env);
- List<Vertex<Long, Double>> result = inputGraph.run(new GSAPageRank<Long>(0.85, 3))
- .collect();
-
- compareWithDelta(result, 0.01);
+ List<Vertex<Long, Double>> result = inputGraph.run(new GSAPageRank<Long>(0.85, 3))
+ .collect();
+
+ compareWithDelta(result, 0.01);
}
private void compareWithDelta(List<Vertex<Long, Double>> result, double delta) {
String resultString = "";
- for (Vertex<Long, Double> v : result) {
- resultString += v.f0.toString() + "," + v.f1.toString() +"\n";
- }
+ for (Vertex<Long, Double> v : result) {
+ resultString += v.f0.toString() + "," + v.f1.toString() + "\n";
+ }
String expectedResult = PageRankData.RANKS_AFTER_3_ITERATIONS;
String[] expected = expectedResult.isEmpty() ? new String[0] : expectedResult.split("\n");
@@ -104,7 +104,7 @@ public class PageRankITCase extends MultipleProgramsTestBase {
String[] resultArray = resultString.isEmpty() ? new String[0] : resultString.split("\n");
Arrays.sort(expected);
- Arrays.sort(resultArray);
+ Arrays.sort(resultArray);
for (int i = 0; i < expected.length; i++) {
String[] expectedFields = expected[i].split(",");
@@ -114,7 +114,7 @@ public class PageRankITCase extends MultipleProgramsTestBase {
double resultPayLoad = Double.parseDouble(resultFields[1]);
Assert.assertTrue("Values differ by more than the permissible delta",
- Math.abs(expectedPayLoad - resultPayLoad) < delta);
+ Math.abs(expectedPayLoad - resultPayLoad) < delta);
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/GatherSumApplyITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/GatherSumApplyITCase.java b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/GatherSumApplyITCase.java
index cf960b4..5ce2e28 100644
--- a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/GatherSumApplyITCase.java
+++ b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/GatherSumApplyITCase.java
@@ -37,7 +37,7 @@ import java.util.List;
@RunWith(Parameterized.class)
public class GatherSumApplyITCase extends MultipleProgramsTestBase {
- public GatherSumApplyITCase(TestExecutionMode mode){
+ public GatherSumApplyITCase(TestExecutionMode mode) {
super(mode);
}
@@ -52,16 +52,16 @@ public class GatherSumApplyITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, NullValue> inputGraph = Graph.fromDataSet(
- ConnectedComponentsDefaultData.getDefaultEdgeDataSet(env),
- new InitMapperCC(), env);
+ ConnectedComponentsDefaultData.getDefaultEdgeDataSet(env),
+ new InitMapperCC(), env);
- List<Vertex<Long, Long>> result = inputGraph.run(
- new GSAConnectedComponents<Long, Long, NullValue>(16)).collect();
+ List<Vertex<Long, Long>> result = inputGraph.run(
+ new GSAConnectedComponents<Long, Long, NullValue>(16)).collect();
expectedResult = "1,1\n" +
- "2,1\n" +
- "3,1\n" +
- "4,1\n";
+ "2,1\n" +
+ "3,1\n" +
+ "4,1\n";
compareResultAsTuples(result, expectedResult);
}
@@ -75,17 +75,17 @@ public class GatherSumApplyITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, NullValue, Double> inputGraph = Graph.fromDataSet(
- SingleSourceShortestPathsData.getDefaultEdgeDataSet(env),
- new InitMapperSSSP(), env);
+ SingleSourceShortestPathsData.getDefaultEdgeDataSet(env),
+ new InitMapperSSSP(), env);
- List<Vertex<Long, Double>> result = inputGraph.run(
- new GSASingleSourceShortestPaths<Long, NullValue>(1L, 16)).collect();
+ List<Vertex<Long, Double>> result = inputGraph.run(
+ new GSASingleSourceShortestPaths<Long, NullValue>(1L, 16)).collect();
expectedResult = "1,0.0\n" +
- "2,12.0\n" +
- "3,13.0\n" +
- "4,47.0\n" +
- "5,48.0\n";
+ "2,12.0\n" +
+ "3,13.0\n" +
+ "4,47.0\n" +
+ "5,48.0\n";
compareResultAsTuples(result, expectedResult);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/examples/SingleSourceShortestPathsITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/examples/SingleSourceShortestPathsITCase.java b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/examples/SingleSourceShortestPathsITCase.java
index 9019d0b..2fd8812 100644
--- a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/examples/SingleSourceShortestPathsITCase.java
+++ b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/test/examples/SingleSourceShortestPathsITCase.java
@@ -40,51 +40,51 @@ import java.io.File;
@RunWith(Parameterized.class)
public class SingleSourceShortestPathsITCase extends MultipleProgramsTestBase {
- private String edgesPath;
-
- private String resultPath;
-
- private String expected;
-
- @Rule
- public TemporaryFolder tempFolder = new TemporaryFolder();
-
- public SingleSourceShortestPathsITCase(TestExecutionMode mode) {
- super(mode);
- }
-
- @Before
- public void before() throws Exception {
- resultPath = tempFolder.newFile().toURI().toString();
-
- File edgesFile = tempFolder.newFile();
- Files.write(SingleSourceShortestPathsData.EDGES, edgesFile, Charsets.UTF_8);
- edgesPath = edgesFile.toURI().toString();
- }
-
- @Test
- public void testSSSPExample() throws Exception {
- SingleSourceShortestPaths.main(new String[]{SingleSourceShortestPathsData.SRC_VERTEX_ID + "",
- edgesPath, resultPath, 10 + ""});
- expected = SingleSourceShortestPathsData.RESULTED_SINGLE_SOURCE_SHORTEST_PATHS;
- }
-
- @Test
- public void testGSASSSPExample() throws Exception {
- GSASingleSourceShortestPaths.main(new String[]{SingleSourceShortestPathsData.SRC_VERTEX_ID + "",
- edgesPath, resultPath, 10 + ""});
- expected = SingleSourceShortestPathsData.RESULTED_SINGLE_SOURCE_SHORTEST_PATHS;
- }
-
- @Test
- public void testPregelSSSPExample() throws Exception {
- PregelSSSP.main(new String[]{SingleSourceShortestPathsData.SRC_VERTEX_ID + "",
- edgesPath, resultPath, 10 + ""});
- expected = SingleSourceShortestPathsData.RESULTED_SINGLE_SOURCE_SHORTEST_PATHS;
- }
-
- @After
- public void after() throws Exception {
- TestBaseUtils.compareResultsByLinesInMemory(expected, resultPath);
- }
+ private String edgesPath;
+
+ private String resultPath;
+
+ private String expected;
+
+ @Rule
+ public TemporaryFolder tempFolder = new TemporaryFolder();
+
+ public SingleSourceShortestPathsITCase(TestExecutionMode mode) {
+ super(mode);
+ }
+
+ @Before
+ public void before() throws Exception {
+ resultPath = tempFolder.newFile().toURI().toString();
+
+ File edgesFile = tempFolder.newFile();
+ Files.write(SingleSourceShortestPathsData.EDGES, edgesFile, Charsets.UTF_8);
+ edgesPath = edgesFile.toURI().toString();
+ }
+
+ @Test
+ public void testSSSPExample() throws Exception {
+ SingleSourceShortestPaths.main(new String[]{ SingleSourceShortestPathsData.SRC_VERTEX_ID + "",
+ edgesPath, resultPath, 10 + "" });
+ expected = SingleSourceShortestPathsData.RESULTED_SINGLE_SOURCE_SHORTEST_PATHS;
+ }
+
+ @Test
+ public void testGSASSSPExample() throws Exception {
+ GSASingleSourceShortestPaths.main(new String[]{ SingleSourceShortestPathsData.SRC_VERTEX_ID + "",
+ edgesPath, resultPath, 10 + "" });
+ expected = SingleSourceShortestPathsData.RESULTED_SINGLE_SOURCE_SHORTEST_PATHS;
+ }
+
+ @Test
+ public void testPregelSSSPExample() throws Exception {
+ PregelSSSP.main(new String[]{ SingleSourceShortestPathsData.SRC_VERTEX_ID + "",
+ edgesPath, resultPath, 10 + "" });
+ expected = SingleSourceShortestPathsData.RESULTED_SINGLE_SOURCE_SHORTEST_PATHS;
+ }
+
+ @After
+ public void after() throws Exception {
+ TestBaseUtils.compareResultsByLinesInMemory(expected, resultPath);
+ }
}
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/GatherSumApplyConfigurationITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/GatherSumApplyConfigurationITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/GatherSumApplyConfigurationITCase.java
index 98ecf16..183522d 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/GatherSumApplyConfigurationITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/GatherSumApplyConfigurationITCase.java
@@ -59,7 +59,7 @@ public class GatherSumApplyConfigurationITCase extends MultipleProgramsTestBase
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
- TestGraphUtils.getLongLongEdges(), env).mapVertices(new AssignOneMapper());
+ TestGraphUtils.getLongLongEdges(), env).mapVertices(new AssignOneMapper());
// create the configuration object
GSAConfiguration parameters = new GSAConfiguration();
@@ -71,31 +71,30 @@ public class GatherSumApplyConfigurationITCase extends MultipleProgramsTestBase
parameters.setOptNumVertices(true);
Graph<Long, Long, Long> res = graph.runGatherSumApplyIteration(new Gather(), new Sum(),
- new Apply(), 10, parameters);
+ new Apply(), 10, parameters);
- DataSet<Vertex<Long, Long>> data = res.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
+ DataSet<Vertex<Long, Long>> data = res.getVertices();
+ List<Vertex<Long, Long>> result = data.collect();
expectedResult = "1,11\n" +
- "2,11\n" +
- "3,11\n" +
- "4,11\n" +
- "5,11";
-
+ "2,11\n" +
+ "3,11\n" +
+ "4,11\n" +
+ "5,11";
+
compareResultAsTuples(result, expectedResult);
}
@Test
public void testIterationConfiguration() throws Exception {
-
/*
* Test name, parallelism and solutionSetUnmanaged parameters
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
GatherSumApplyIteration<Long, Long, Long, Long> iteration = GatherSumApplyIteration
- .withEdges(TestGraphUtils.getLongLongEdgeData(env), new DummyGather(),
- new DummySum(), new DummyApply(), 10);
+ .withEdges(TestGraphUtils.getLongLongEdgeData(env), new DummyGather(),
+ new DummySum(), new DummyApply(), 10);
GSAConfiguration parameters = new GSAConfiguration();
parameters.setName("gelly iteration");
@@ -109,20 +108,19 @@ public class GatherSumApplyConfigurationITCase extends MultipleProgramsTestBase
Assert.assertEquals(true, iteration.getIterationConfiguration().isSolutionSetUnmanagedMemory());
DataSet<Vertex<Long, Long>> data = TestGraphUtils.getLongLongVertexData(env).runOperation(iteration);
- List<Vertex<Long, Long>> result= data.collect();
-
+ List<Vertex<Long, Long>> result = data.collect();
+
expectedResult = "1,11\n" +
- "2,12\n" +
- "3,13\n" +
- "4,14\n" +
- "5,15";
-
+ "2,12\n" +
+ "3,13\n" +
+ "4,14\n" +
+ "5,15";
+
compareResultAsTuples(result, expectedResult);
}
@Test
public void testIterationDefaultDirection() throws Exception {
-
/*
* Test that if no direction parameter is given, the iteration works as before
* (i.e. it gathers information from the IN edges and neighbors and the information is calculated for an OUT edge
@@ -137,27 +135,26 @@ public class GatherSumApplyConfigurationITCase extends MultipleProgramsTestBase
edges.remove(0);
Graph<Long, HashSet<Long>, Long> graph = Graph
- .fromCollection(TestGraphUtils.getLongLongVertices(), edges, env)
- .mapVertices(new GatherSumApplyConfigurationITCase.InitialiseHashSetMapper());
+ .fromCollection(TestGraphUtils.getLongLongVertices(), edges, env)
+ .mapVertices(new GatherSumApplyConfigurationITCase.InitialiseHashSetMapper());
DataSet<Vertex<Long, HashSet<Long>>> resultedVertices = graph.runGatherSumApplyIteration(
new GetReachableVertices(), new FindAllReachableVertices(), new UpdateReachableVertices(), 4)
- .getVertices();
+ .getVertices();
List<Vertex<Long, HashSet<Long>>> result = resultedVertices.collect();
expectedResult = "1,[1, 2, 3, 4, 5]\n"
- +"2,[2]\n"
- +"3,[1, 2, 3, 4, 5]\n"
- +"4,[1, 2, 3, 4, 5]\n"
- +"5,[1, 2, 3, 4, 5]\n";
+ + "2,[2]\n"
+ + "3,[1, 2, 3, 4, 5]\n"
+ + "4,[1, 2, 3, 4, 5]\n"
+ + "5,[1, 2, 3, 4, 5]\n";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testIterationDirectionIN() throws Exception {
-
/*
* Test that if the direction parameter IN is given, the iteration works as expected
* (i.e. it gathers information from the OUT edges and neighbors and the information is calculated for an IN edge
@@ -175,27 +172,26 @@ public class GatherSumApplyConfigurationITCase extends MultipleProgramsTestBase
edges.remove(0);
Graph<Long, HashSet<Long>, Long> graph = Graph
- .fromCollection(TestGraphUtils.getLongLongVertices(), edges, env)
- .mapVertices(new GatherSumApplyConfigurationITCase.InitialiseHashSetMapper());
+ .fromCollection(TestGraphUtils.getLongLongVertices(), edges, env)
+ .mapVertices(new GatherSumApplyConfigurationITCase.InitialiseHashSetMapper());
DataSet<Vertex<Long, HashSet<Long>>> resultedVertices = graph.runGatherSumApplyIteration(
new GetReachableVertices(), new FindAllReachableVertices(), new UpdateReachableVertices(), 4,
- parameters)
- .getVertices();
+ parameters)
+ .getVertices();
List<Vertex<Long, HashSet<Long>>> result = resultedVertices.collect();
expectedResult = "1,[1, 3, 4, 5]\n"
- +"2,[1, 2, 3, 4, 5]\n"
- +"3,[1, 3, 4, 5]\n"
- +"4,[1, 3, 4, 5]\n"
- +"5,[1, 3, 4, 5]\n";
+ + "2,[1, 2, 3, 4, 5]\n"
+ + "3,[1, 3, 4, 5]\n"
+ + "4,[1, 3, 4, 5]\n"
+ + "5,[1, 3, 4, 5]\n";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testIterationDirectionALL() throws Exception {
-
/*
* Test that if the direction parameter OUT is given, the iteration works as expected
* (i.e. it gathers information from both IN and OUT edges and neighbors
@@ -212,21 +208,21 @@ public class GatherSumApplyConfigurationITCase extends MultipleProgramsTestBase
edges.remove(0);
Graph<Long, HashSet<Long>, Long> graph = Graph
- .fromCollection(TestGraphUtils.getLongLongVertices(), edges, env)
- .mapVertices(new GatherSumApplyConfigurationITCase.InitialiseHashSetMapper());
+ .fromCollection(TestGraphUtils.getLongLongVertices(), edges, env)
+ .mapVertices(new GatherSumApplyConfigurationITCase.InitialiseHashSetMapper());
DataSet<Vertex<Long, HashSet<Long>>> resultedVertices = graph.runGatherSumApplyIteration(
new GetReachableVertices(), new FindAllReachableVertices(), new UpdateReachableVertices(), 4,
parameters)
- .getVertices();
+ .getVertices();
List<Vertex<Long, HashSet<Long>>> result = resultedVertices.collect();
expectedResult = "1,[1, 2, 3, 4, 5]\n"
- +"2,[1, 2, 3, 4, 5]\n"
- +"3,[1, 2, 3, 4, 5]\n"
- +"4,[1, 2, 3, 4, 5]\n"
- +"5,[1, 2, 3, 4, 5]\n";
+ + "2,[1, 2, 3, 4, 5]\n"
+ + "3,[1, 2, 3, 4, 5]\n"
+ + "4,[1, 2, 3, 4, 5]\n"
+ + "5,[1, 2, 3, 4, 5]\n";
compareResultAsTuples(result, expectedResult);
}
@@ -246,7 +242,7 @@ public class GatherSumApplyConfigurationITCase extends MultipleProgramsTestBase
// test aggregator
if (getSuperstepNumber() == 2) {
- long aggrValue = ((LongValue)getPreviousIterationAggregate("superstepAggregator")).getValue();
+ long aggrValue = ((LongValue) getPreviousIterationAggregate("superstepAggregator")).getValue();
Assert.assertEquals(7, aggrValue);
}
@@ -381,7 +377,7 @@ public class GatherSumApplyConfigurationITCase extends MultipleProgramsTestBase
private static final class FindAllReachableVertices extends SumFunction<HashSet<Long>, Long, HashSet<Long>> {
@Override
public HashSet<Long> sum(HashSet<Long> newSet, HashSet<Long> currentSet) {
- for(Long l : newSet) {
+ for (Long l : newSet) {
currentSet.add(l);
}
return currentSet;
@@ -394,7 +390,7 @@ public class GatherSumApplyConfigurationITCase extends MultipleProgramsTestBase
@Override
public void apply(HashSet<Long> newValue, HashSet<Long> currentValue) {
newValue.addAll(currentValue);
- if(newValue.size()>currentValue.size()) {
+ if (newValue.size() > currentValue.size()) {
setResult(newValue);
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/ScatterGatherConfigurationITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/ScatterGatherConfigurationITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/ScatterGatherConfigurationITCase.java
index 9100883..3c091a9 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/ScatterGatherConfigurationITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/ScatterGatherConfigurationITCase.java
@@ -46,11 +46,11 @@ import java.util.List;
@RunWith(Parameterized.class)
public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
- public ScatterGatherConfigurationITCase(TestExecutionMode mode){
+ public ScatterGatherConfigurationITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
+ private String expectedResult;
@Test
public void testRunWithConfiguration() throws Exception {
@@ -60,7 +60,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
- TestGraphUtils.getLongLongEdges(), env).mapVertices(new AssignOneMapper());
+ TestGraphUtils.getLongLongEdges(), env).mapVertices(new AssignOneMapper());
// create the configuration object
ScatterGatherConfiguration parameters = new ScatterGatherConfiguration();
@@ -71,31 +71,30 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
parameters.setOptNumVertices(true);
Graph<Long, Long, Long> res = graph.runScatterGatherIteration(
- new MessageFunction(), new UpdateFunction(), 10, parameters);
+ new MessageFunction(), new UpdateFunction(), 10, parameters);
DataSet<Vertex<Long, Long>> data = res.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
+ List<Vertex<Long, Long>> result = data.collect();
expectedResult = "1,11\n" +
- "2,11\n" +
- "3,11\n" +
- "4,11\n" +
- "5,11";
+ "2,11\n" +
+ "3,11\n" +
+ "4,11\n" +
+ "5,11";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testIterationConfiguration() throws Exception {
-
/*
* Test name, parallelism and solutionSetUnmanaged parameters
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
ScatterGatherIteration<Long, Long, Long, Long> iteration = ScatterGatherIteration
- .withEdges(TestGraphUtils.getLongLongEdgeData(env), new DummyMessageFunction(),
- new DummyUpdateFunction(), 10);
+ .withEdges(TestGraphUtils.getLongLongEdgeData(env), new DummyMessageFunction(),
+ new DummyUpdateFunction(), 10);
ScatterGatherConfiguration parameters = new ScatterGatherConfiguration();
parameters.setName("gelly iteration");
@@ -109,13 +108,13 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
Assert.assertEquals(true, iteration.getIterationConfiguration().isSolutionSetUnmanagedMemory());
DataSet<Vertex<Long, Long>> data = TestGraphUtils.getLongLongVertexData(env).runOperation(iteration);
- List<Vertex<Long, Long>> result= data.collect();
+ List<Vertex<Long, Long>> result = data.collect();
expectedResult = "1,11\n" +
- "2,12\n" +
- "3,13\n" +
- "4,14\n" +
- "5,15";
+ "2,12\n" +
+ "3,13\n" +
+ "4,14\n" +
+ "5,15";
compareResultAsTuples(result, expectedResult);
}
@@ -129,27 +128,26 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
- TestGraphUtils.getLongLongEdges(), env).mapVertices(new AssignOneMapper());
+ TestGraphUtils.getLongLongEdges(), env).mapVertices(new AssignOneMapper());
Graph<Long, Long, Long> res = graph.runScatterGatherIteration(
- new MessageFunctionDefault(), new UpdateFunctionDefault(), 5);
+ new MessageFunctionDefault(), new UpdateFunctionDefault(), 5);
DataSet<Tuple2<Long, Long>> data = res.getVertices().map(new VertexToTuple2Map<Long, Long>());
- List<Tuple2<Long, Long>> result= data.collect();
+ List<Tuple2<Long, Long>> result = data.collect();
expectedResult = "1,6\n" +
- "2,6\n" +
- "3,6\n" +
- "4,6\n" +
- "5,6";
+ "2,6\n" +
+ "3,6\n" +
+ "4,6\n" +
+ "5,6";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testIterationDefaultDirection() throws Exception {
-
/*
* Test that if no direction parameter is given, the iteration works as before
* (i.e. it collects messages from the in-neighbors and sends them to the out-neighbors)
@@ -157,27 +155,26 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, HashSet<Long>, Long> graph = Graph
- .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
- .mapVertices(new InitialiseHashSetMapper());
+ .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
+ .mapVertices(new InitialiseHashSetMapper());
DataSet<Vertex<Long, HashSet<Long>>> resultedVertices = graph
- .runScatterGatherIteration(new IdMessengerTrg(), new VertexUpdateDirection(), 5)
- .getVertices();
+ .runScatterGatherIteration(new IdMessengerTrg(), new VertexUpdateDirection(), 5)
+ .getVertices();
- List<Vertex<Long, HashSet<Long>>> result= resultedVertices.collect();
+ List<Vertex<Long, HashSet<Long>>> result = resultedVertices.collect();
expectedResult = "1,[5]\n" +
- "2,[1]\n" +
- "3,[1, 2]\n" +
- "4,[3]\n" +
- "5,[3, 4]";
+ "2,[1]\n" +
+ "3,[1, 2]\n" +
+ "4,[3]\n" +
+ "5,[3, 4]";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testIterationINDirection() throws Exception {
-
/*
* Test that if the direction parameter is set to IN,
* messages are collected from the out-neighbors and sent to the in-neighbors.
@@ -185,8 +182,8 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, HashSet<Long>, Long> graph = Graph
- .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
- .mapVertices(new InitialiseHashSetMapper());
+ .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
+ .mapVertices(new InitialiseHashSetMapper());
// configure the iteration
ScatterGatherConfiguration parameters = new ScatterGatherConfiguration();
@@ -194,23 +191,22 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
parameters.setDirection(EdgeDirection.IN);
DataSet<Vertex<Long, HashSet<Long>>> resultedVertices = graph
- .runScatterGatherIteration(new IdMessengerSrc(), new VertexUpdateDirection(), 5, parameters)
- .getVertices();
+ .runScatterGatherIteration(new IdMessengerSrc(), new VertexUpdateDirection(), 5, parameters)
+ .getVertices();
- List<Vertex<Long, HashSet<Long>>> result= resultedVertices.collect();
+ List<Vertex<Long, HashSet<Long>>> result = resultedVertices.collect();
expectedResult = "1,[2, 3]\n" +
- "2,[3]\n" +
- "3,[4, 5]\n" +
- "4,[5]\n" +
- "5,[1]";
+ "2,[3]\n" +
+ "3,[4, 5]\n" +
+ "4,[5]\n" +
+ "5,[1]";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testIterationALLDirection() throws Exception {
-
/*
* Test that if the direction parameter is set to ALL,
* messages are collected from all the neighbors and sent to all the neighbors.
@@ -218,8 +214,8 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, HashSet<Long>, Long> graph = Graph
- .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
- .mapVertices(new InitialiseHashSetMapper());
+ .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
+ .mapVertices(new InitialiseHashSetMapper());
// configure the iteration
ScatterGatherConfiguration parameters = new ScatterGatherConfiguration();
@@ -227,23 +223,22 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
parameters.setDirection(EdgeDirection.ALL);
DataSet<Vertex<Long, HashSet<Long>>> resultedVertices = graph
- .runScatterGatherIteration(new IdMessengerAll(), new VertexUpdateDirection(), 5, parameters)
- .getVertices();
+ .runScatterGatherIteration(new IdMessengerAll(), new VertexUpdateDirection(), 5, parameters)
+ .getVertices();
- List<Vertex<Long, HashSet<Long>>> result= resultedVertices.collect();
+ List<Vertex<Long, HashSet<Long>>> result = resultedVertices.collect();
expectedResult = "1,[2, 3, 5]\n" +
- "2,[1, 3]\n" +
- "3,[1, 2, 4, 5]\n" +
- "4,[3, 5]\n" +
- "5,[1, 3, 4]";
+ "2,[1, 3]\n" +
+ "3,[1, 2, 4, 5]\n" +
+ "4,[3, 5]\n" +
+ "5,[1, 3, 4]";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testSendToAllDirectionIN() throws Exception {
-
/*
* Test that sendMessageToAllNeighbors() works correctly
* when the direction is set to IN
@@ -251,8 +246,8 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, HashSet<Long>, Long> graph = Graph
- .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
- .mapVertices(new InitialiseHashSetMapper());
+ .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
+ .mapVertices(new InitialiseHashSetMapper());
// configure the iteration
ScatterGatherConfiguration parameters = new ScatterGatherConfiguration();
@@ -260,23 +255,22 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
parameters.setDirection(EdgeDirection.IN);
DataSet<Vertex<Long, HashSet<Long>>> resultedVertices = graph
- .runScatterGatherIteration(new SendMsgToAll(), new VertexUpdateDirection(), 5, parameters)
- .getVertices();
+ .runScatterGatherIteration(new SendMsgToAll(), new VertexUpdateDirection(), 5, parameters)
+ .getVertices();
List<Vertex<Long, HashSet<Long>>> result = resultedVertices.collect();
expectedResult = "1,[2, 3]\n" +
- "2,[3]\n" +
- "3,[4, 5]\n" +
- "4,[5]\n" +
- "5,[1]";
+ "2,[3]\n" +
+ "3,[4, 5]\n" +
+ "4,[5]\n" +
+ "5,[1]";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testSendToAllDirectionOUT() throws Exception {
-
/*
* Test that sendMessageToAllNeighbors() works correctly
* when the direction is set to OUT
@@ -284,8 +278,8 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, HashSet<Long>, Long> graph = Graph
- .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
- .mapVertices(new InitialiseHashSetMapper());
+ .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
+ .mapVertices(new InitialiseHashSetMapper());
// configure the iteration
ScatterGatherConfiguration parameters = new ScatterGatherConfiguration();
@@ -293,23 +287,22 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
parameters.setDirection(EdgeDirection.OUT);
DataSet<Vertex<Long, HashSet<Long>>> resultedVertices = graph
- .runScatterGatherIteration(new SendMsgToAll(), new VertexUpdateDirection(), 5, parameters)
- .getVertices();
+ .runScatterGatherIteration(new SendMsgToAll(), new VertexUpdateDirection(), 5, parameters)
+ .getVertices();
List<Vertex<Long, HashSet<Long>>> result = resultedVertices.collect();
expectedResult = "1,[5]\n" +
- "2,[1]\n" +
- "3,[1, 2]\n" +
- "4,[3]\n" +
- "5,[3, 4]";
+ "2,[1]\n" +
+ "3,[1, 2]\n" +
+ "4,[3]\n" +
+ "5,[3, 4]";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testSendToAllDirectionALL() throws Exception {
-
/*
* Test that sendMessageToAllNeighbors() works correctly
* when the direction is set to ALL
@@ -317,8 +310,8 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, HashSet<Long>, Long> graph = Graph
- .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
- .mapVertices(new InitialiseHashSetMapper());
+ .fromCollection(TestGraphUtils.getLongLongVertices(), TestGraphUtils.getLongLongEdges(), env)
+ .mapVertices(new InitialiseHashSetMapper());
// configure the iteration
ScatterGatherConfiguration parameters = new ScatterGatherConfiguration();
@@ -326,16 +319,16 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
parameters.setDirection(EdgeDirection.ALL);
DataSet<Vertex<Long, HashSet<Long>>> resultedVertices = graph
- .runScatterGatherIteration(new SendMsgToAll(), new VertexUpdateDirection(), 5, parameters)
- .getVertices();
+ .runScatterGatherIteration(new SendMsgToAll(), new VertexUpdateDirection(), 5, parameters)
+ .getVertices();
List<Vertex<Long, HashSet<Long>>> result = resultedVertices.collect();
expectedResult = "1,[2, 3, 5]\n" +
- "2,[1, 3]\n" +
- "3,[1, 2, 4, 5]\n" +
- "4,[3, 5]\n" +
- "5,[1, 3, 4]";
+ "2,[1, 3]\n" +
+ "3,[1, 2, 4, 5]\n" +
+ "4,[3, 5]\n" +
+ "5,[1, 3, 4]";
compareResultAsTuples(result, expectedResult);
}
@@ -350,25 +343,24 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
- TestGraphUtils.getLongLongEdges(), env);
+ TestGraphUtils.getLongLongEdges(), env);
DataSet<Vertex<Long, Long>> verticesWithNumVertices = graph.runScatterGatherIteration(new DummyMessageFunction(),
- new UpdateFunctionNumVertices(), 2).getVertices();
+ new UpdateFunctionNumVertices(), 2).getVertices();
- List<Vertex<Long, Long>> result= verticesWithNumVertices.collect();
+ List<Vertex<Long, Long>> result = verticesWithNumVertices.collect();
expectedResult = "1,-1\n" +
- "2,-1\n" +
- "3,-1\n" +
- "4,-1\n" +
- "5,-1";
+ "2,-1\n" +
+ "3,-1\n" +
+ "4,-1\n" +
+ "5,-1";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testInDegreesSet() throws Exception {
-
/*
* Test that if the degrees are set, they can be accessed in every superstep
* inside the update function and the value
@@ -377,7 +369,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
- TestGraphUtils.getLongLongEdges(), env);
+ TestGraphUtils.getLongLongEdges(), env);
// configure the iteration
ScatterGatherConfiguration parameters = new ScatterGatherConfiguration();
@@ -385,47 +377,45 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
parameters.setOptDegrees(true);
DataSet<Vertex<Long, Long>> verticesWithDegrees = graph.runScatterGatherIteration(
- new DegreesMessageFunction(), new UpdateFunctionInDegrees(), 5, parameters).getVertices();
+ new DegreesMessageFunction(), new UpdateFunctionInDegrees(), 5, parameters).getVertices();
- List<Vertex<Long, Long>> result= verticesWithDegrees.collect();
+ List<Vertex<Long, Long>> result = verticesWithDegrees.collect();
expectedResult = "1,1\n" +
- "2,1\n" +
- "3,2\n" +
- "4,1\n" +
- "5,2";
+ "2,1\n" +
+ "3,2\n" +
+ "4,1\n" +
+ "5,2";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testInDegreesNotSet() throws Exception {
-
/*
* Test that if the degrees option is not set, then -1 is returned as a value for in-degree.
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
- TestGraphUtils.getLongLongEdges(), env);
+ TestGraphUtils.getLongLongEdges(), env);
DataSet<Vertex<Long, Long>> verticesWithDegrees = graph.runScatterGatherIteration(
- new DummyMessageFunction(), new UpdateFunctionInDegrees(), 2).getVertices();
+ new DummyMessageFunction(), new UpdateFunctionInDegrees(), 2).getVertices();
- List<Vertex<Long, Long>> result= verticesWithDegrees.collect();
+ List<Vertex<Long, Long>> result = verticesWithDegrees.collect();
expectedResult = "1,-1\n" +
- "2,-1\n" +
- "3,-1\n" +
- "4,-1\n" +
- "5,-1";
+ "2,-1\n" +
+ "3,-1\n" +
+ "4,-1\n" +
+ "5,-1";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testOutDegreesSet() throws Exception {
-
/*
* Test that if the degrees are set, they can be accessed in every superstep
* inside the update function and the value
@@ -434,7 +424,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
- TestGraphUtils.getLongLongEdges(), env);
+ TestGraphUtils.getLongLongEdges(), env);
// configure the iteration
ScatterGatherConfiguration parameters = new ScatterGatherConfiguration();
@@ -442,47 +432,45 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
parameters.setOptDegrees(true);
DataSet<Vertex<Long, Long>> verticesWithDegrees = graph.runScatterGatherIteration(
- new DegreesMessageFunction(), new UpdateFunctionOutDegrees(), 5, parameters).getVertices();
+ new DegreesMessageFunction(), new UpdateFunctionOutDegrees(), 5, parameters).getVertices();
- List<Vertex<Long, Long>> result= verticesWithDegrees.collect();
+ List<Vertex<Long, Long>> result = verticesWithDegrees.collect();
expectedResult = "1,2\n" +
- "2,1\n" +
- "3,2\n" +
- "4,1\n" +
- "5,1";
+ "2,1\n" +
+ "3,2\n" +
+ "4,1\n" +
+ "5,1";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testOutDegreesNotSet() throws Exception {
-
/*
* Test that if the degrees option is not set, then -1 is returned as a value for out-degree.
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
- TestGraphUtils.getLongLongEdges(), env);
+ TestGraphUtils.getLongLongEdges(), env);
DataSet<Vertex<Long, Long>> verticesWithDegrees = graph.runScatterGatherIteration(
- new DummyMessageFunction(), new UpdateFunctionInDegrees(), 2).getVertices();
+ new DummyMessageFunction(), new UpdateFunctionOutDegrees(), 2).getVertices();
- List<Vertex<Long, Long>> result= verticesWithDegrees.collect();
+ List<Vertex<Long, Long>> result = verticesWithDegrees.collect();
expectedResult = "1,-1\n" +
- "2,-1\n" +
- "3,-1\n" +
- "4,-1\n" +
- "5,-1";
+ "2,-1\n" +
+ "3,-1\n" +
+ "4,-1\n" +
+ "5,-1";
compareResultAsTuples(result, expectedResult);
}
@Test
public void testDirectionALLAndDegrees() throws Exception {
-
/*
* Compute the number of neighbors in a vertex - centric manner, and verify that it is equal to
* the sum: inDegree + outDegree.
@@ -490,7 +478,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Boolean, Long> graph = Graph.fromCollection(TestGraphUtils.getLongBooleanVertices(),
- TestGraphUtils.getLongLongEdges(), env);
+ TestGraphUtils.getLongLongEdges(), env);
// configure the iteration
ScatterGatherConfiguration parameters = new ScatterGatherConfiguration();
@@ -499,15 +487,15 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
parameters.setDirection(EdgeDirection.ALL);
DataSet<Vertex<Long, Boolean>> verticesWithNumNeighbors = graph.runScatterGatherIteration(
- new IdMessenger(), new VertexUpdateNumNeighbors(), 1, parameters).getVertices();
+ new IdMessenger(), new VertexUpdateNumNeighbors(), 1, parameters).getVertices();
- List<Vertex<Long, Boolean>> result= verticesWithNumNeighbors.collect();
+ List<Vertex<Long, Boolean>> result = verticesWithNumNeighbors.collect();
expectedResult = "1,true\n" +
- "2,true\n" +
- "3,true\n" +
- "4,true\n" +
- "5,true";
+ "2,true\n" +
+ "3,true\n" +
+ "4,true\n" +
+ "5,true";
compareResultAsTuples(result, expectedResult);
}
@@ -530,7 +518,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
// test aggregator
if (getSuperstepNumber() == 2) {
- long aggrValue = ((LongValue)getPreviousIterationAggregate("superstepAggregator")).getValue();
+ long aggrValue = ((LongValue) getPreviousIterationAggregate("superstepAggregator")).getValue();
Assert.assertEquals(5, aggrValue);
}
}
@@ -612,7 +600,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
@Override
public void updateVertex(Vertex<Long, Long> vertex, MessageIterator<Long> inMessages) {
- setNewVertexValue(getNumberOfVertices());
+ setNewVertexValue(getNumberOfVertices());
}
}
@@ -642,8 +630,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
if (vertex.getId() == 1) {
Assert.assertEquals(2, getOutDegree());
Assert.assertEquals(1, getInDegree());
- }
- else if(vertex.getId() == 3) {
+ } else if (vertex.getId() == 3) {
Assert.assertEquals(2, getOutDegree());
Assert.assertEquals(2, getInDegree());
}
@@ -659,7 +646,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
public void updateVertex(Vertex<Long, HashSet<Long>> vertex, MessageIterator<Long> messages) throws Exception {
vertex.getValue().clear();
- for(long msg : messages) {
+ for (long msg : messages) {
vertex.getValue().add(msg);
}
@@ -688,15 +675,14 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
}
@SuppressWarnings("serial")
- private static final class VertexUpdateNumNeighbors extends GatherFunction<Long, Boolean,
- Long> {
+ private static final class VertexUpdateNumNeighbors extends GatherFunction<Long, Boolean, Long> {
@Override
public void updateVertex(Vertex<Long, Boolean> vertex, MessageIterator<Long> messages) throws Exception {
long count = 0;
- for(@SuppressWarnings("unused") long msg : messages) {
+ for (@SuppressWarnings("unused") long msg : messages) {
count++;
}
setNewVertexValue(count == (getInDegree() + getOutDegree()));
@@ -731,7 +717,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
@Override
public void sendMessages(Vertex<Long, HashSet<Long>> vertex) throws Exception {
for (Edge<Long, Long> edge : getEdges()) {
- if(!edge.getSource().equals(vertex.getId())) {
+ if (!edge.getSource().equals(vertex.getId())) {
sendMessageTo(edge.getSource(), vertex.getId());
} else {
sendMessageTo(edge.getTarget(), vertex.getId());
@@ -755,7 +741,7 @@ public class ScatterGatherConfigurationITCase extends MultipleProgramsTestBase {
@Override
public void sendMessages(Vertex<Long, Boolean> vertex) throws Exception {
for (Edge<Long, Long> edge : getEdges()) {
- if(!edge.getSource().equals(vertex.getId())) {
+ if (!edge.getSource().equals(vertex.getId())) {
sendMessageTo(edge.getSource(), vertex.getId());
} else {
sendMessageTo(edge.getTarget(), vertex.getId());
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesITCase.java
index db2ca0d..280eb92 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/DegreesITCase.java
@@ -18,7 +18,6 @@
package org.apache.flink.graph.test.operations;
-import java.util.List;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.tuple.Tuple2;
@@ -31,149 +30,147 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import java.util.List;
+
@RunWith(Parameterized.class)
public class DegreesITCase extends MultipleProgramsTestBase {
- public DegreesITCase(TestExecutionMode mode){
+ public DegreesITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
-
+ private String expectedResult;
@Test
public void testOutDegrees() throws Exception {
/*
* Test outDegrees()
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
- DataSet<Tuple2<Long, LongValue>> data = graph.outDegrees();
- List<Tuple2<Long, LongValue>> result = data.collect();
-
-
- expectedResult = "1,2\n" +
- "2,1\n" +
- "3,2\n" +
- "4,1\n" +
- "5,1\n";
-
- compareResultAsTuples(result, expectedResult);
-
- }
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
+ DataSet<Tuple2<Long, LongValue>> data = graph.outDegrees();
+ List<Tuple2<Long, LongValue>> result = data.collect();
+
+
+ expectedResult = "1,2\n" +
+ "2,1\n" +
+ "3,2\n" +
+ "4,1\n" +
+ "5,1\n";
+
+ compareResultAsTuples(result, expectedResult);
+ }
@Test
public void testOutDegreesWithNoOutEdges() throws Exception {
/*
* Test outDegrees() no outgoing edges
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeDataWithZeroDegree(env), env);
-
-
-
- DataSet<Tuple2<Long, LongValue>> data = graph.outDegrees();
- List<Tuple2<Long, LongValue>> result = data.collect();
-
- expectedResult = "1,3\n" +
- "2,1\n" +
- "3,1\n" +
- "4,1\n" +
- "5,0\n";
-
- compareResultAsTuples(result, expectedResult);
- }
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeDataWithZeroDegree(env), env);
+
+
+ DataSet<Tuple2<Long, LongValue>> data = graph.outDegrees();
+ List<Tuple2<Long, LongValue>> result = data.collect();
+
+ expectedResult = "1,3\n" +
+ "2,1\n" +
+ "3,1\n" +
+ "4,1\n" +
+ "5,0\n";
+
+ compareResultAsTuples(result, expectedResult);
+ }
@Test
public void testInDegrees() throws Exception {
/*
* Test inDegrees()
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
+ DataSet<Tuple2<Long, LongValue>> data = graph.inDegrees();
+ List<Tuple2<Long, LongValue>> result = data.collect();
- DataSet<Tuple2<Long, LongValue>> data = graph.inDegrees();
- List<Tuple2<Long, LongValue>> result = data.collect();
-
- expectedResult = "1,1\n" +
- "2,1\n" +
- "3,2\n" +
- "4,1\n" +
- "5,2\n";
- compareResultAsTuples(result, expectedResult);
- }
+ expectedResult = "1,1\n" +
+ "2,1\n" +
+ "3,2\n" +
+ "4,1\n" +
+ "5,2\n";
+ compareResultAsTuples(result, expectedResult);
+ }
@Test
public void testInDegreesWithNoInEdge() throws Exception {
/*
* Test inDegrees() no ingoing edge
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeDataWithZeroDegree(env), env);
-
- DataSet<Tuple2<Long, LongValue>> data = graph.inDegrees();
- List<Tuple2<Long, LongValue>> result = data.collect();
-
- expectedResult = "1,0\n" +
- "2,1\n" +
- "3,1\n" +
- "4,1\n" +
- "5,3\n";
-
- compareResultAsTuples(result, expectedResult);
- }
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeDataWithZeroDegree(env), env);
+
+ DataSet<Tuple2<Long, LongValue>> data = graph.inDegrees();
+ List<Tuple2<Long, LongValue>> result = data.collect();
+
+ expectedResult = "1,0\n" +
+ "2,1\n" +
+ "3,1\n" +
+ "4,1\n" +
+ "5,3\n";
+
+ compareResultAsTuples(result, expectedResult);
+ }
@Test
public void testGetDegrees() throws Exception {
/*
* Test getDegrees()
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
- Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
- TestGraphUtils.getLongLongEdgeData(env), env);
-
- DataSet<Tuple2<Long, LongValue>> data = graph.getDegrees();
- List<Tuple2<Long, LongValue>> result = data.collect();
-
- expectedResult = "1,3\n" +
- "2,2\n" +
- "3,4\n" +
- "4,2\n" +
- "5,3\n";
-
- compareResultAsTuples(result, expectedResult);
- }
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env),
+ TestGraphUtils.getLongLongEdgeData(env), env);
+
+ DataSet<Tuple2<Long, LongValue>> data = graph.getDegrees();
+ List<Tuple2<Long, LongValue>> result = data.collect();
+
+ expectedResult = "1,3\n" +
+ "2,2\n" +
+ "3,4\n" +
+ "4,2\n" +
+ "5,3\n";
+
+ compareResultAsTuples(result, expectedResult);
+ }
@Test
public void testGetDegreesWithDisconnectedData() throws Exception {
- /*
+ /*
* Test getDegrees() with disconnected data
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
-
- Graph<Long, NullValue, Long> graph =
- Graph.fromDataSet(TestGraphUtils.getDisconnectedLongLongEdgeData(env), env);
-
- DataSet<Tuple2<Long, LongValue>> data = graph.outDegrees();
- List<Tuple2<Long, LongValue>> result = data.collect();
-
- expectedResult = "1,2\n" +
- "2,1\n" +
- "3,0\n" +
- "4,1\n" +
- "5,0\n";
-
- compareResultAsTuples(result, expectedResult);
- }
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+
+ Graph<Long, NullValue, Long> graph =
+ Graph.fromDataSet(TestGraphUtils.getDisconnectedLongLongEdgeData(env), env);
+
+ DataSet<Tuple2<Long, LongValue>> data = graph.outDegrees();
+ List<Tuple2<Long, LongValue>> result = data.collect();
+
+ expectedResult = "1,2\n" +
+ "2,1\n" +
+ "3,0\n" +
+ "4,1\n" +
+ "5,0\n";
+
+ compareResultAsTuples(result, expectedResult);
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
index 59f416f..ab2ffe0 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/FromCollectionITCase.java
@@ -36,84 +36,83 @@ import java.util.List;
@RunWith(Parameterized.class)
public class FromCollectionITCase extends MultipleProgramsTestBase {
- public FromCollectionITCase(TestExecutionMode mode){
+ public FromCollectionITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
-
+ private String expectedResult;
@Test
public void testFromCollectionVerticesEdges() throws Exception {
/*
* Test fromCollection(vertices, edges):
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
- TestGraphUtils.getLongLongEdges(), env);
-
- DataSet<Edge<Long, Long>> data = graph.getEdges();
- List<Edge<Long, Long>> result= data.collect();
-
- expectedResult = "1,2,12\n" +
- "1,3,13\n" +
- "2,3,23\n" +
- "3,4,34\n" +
- "3,5,35\n" +
- "4,5,45\n" +
- "5,1,51\n";
-
- compareResultAsTuples(result, expectedResult);
- }
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongVertices(),
+ TestGraphUtils.getLongLongEdges(), env);
+
+ DataSet<Edge<Long, Long>> data = graph.getEdges();
+ List<Edge<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2,12\n" +
+ "1,3,13\n" +
+ "2,3,23\n" +
+ "3,4,34\n" +
+ "3,5,35\n" +
+ "4,5,45\n" +
+ "5,1,51\n";
+
+ compareResultAsTuples(result, expectedResult);
+ }
@Test
public void testFromCollectionEdgesNoInitialValue() throws Exception {
- /*
+ /*
* Test fromCollection(edges) with no initial value for the vertices
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<Long, NullValue, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongEdges(),
- env);
-
-
- DataSet<Vertex<Long, NullValue>> data = graph.getVertices();
- List<Vertex<Long, NullValue>> result= data.collect();
-
- expectedResult = "1,(null)\n" +
- "2,(null)\n" +
- "3,(null)\n" +
- "4,(null)\n" +
- "5,(null)\n";
-
- compareResultAsTuples(result, expectedResult);
- }
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ Graph<Long, NullValue, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongEdges(),
+ env);
+
+
+ DataSet<Vertex<Long, NullValue>> data = graph.getVertices();
+ List<Vertex<Long, NullValue>> result = data.collect();
+
+ expectedResult = "1,(null)\n" +
+ "2,(null)\n" +
+ "3,(null)\n" +
+ "4,(null)\n" +
+ "5,(null)\n";
+
+ compareResultAsTuples(result, expectedResult);
+ }
@Test
public void testFromCollectionEdgesWithInitialValue() throws Exception {
- /*
+ /*
* Test fromCollection(edges) with vertices initialised by a
* function that takes the id and doubles it
*/
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromCollection(TestGraphUtils.getLongLongEdges(),
- new InitVerticesMapper(), env);
-
- DataSet<Vertex<Long, Long>> data = graph.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
-
- expectedResult = "1,2\n" +
- "2,4\n" +
- "3,6\n" +
- "4,8\n" +
- "5,10\n";
-
- compareResultAsTuples(result, expectedResult);
- }
+ new InitVerticesMapper(), env);
+
+ DataSet<Vertex<Long, Long>> data = graph.getVertices();
+ List<Vertex<Long, Long>> result = data.collect();
+
+ expectedResult = "1,2\n" +
+ "2,4\n" +
+ "3,6\n" +
+ "4,8\n" +
+ "5,10\n";
+
+ compareResultAsTuples(result, expectedResult);
+ }
@SuppressWarnings("serial")
private static final class InitVerticesMapper implements MapFunction<Long, Long> {
- public Long map(Long vertexId) {
- return vertexId * 2;
- }
+ public Long map(Long vertexId) {
+ return vertexId * 2;
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
index 10db9be..77dd4d1 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationITCase.java
@@ -40,51 +40,50 @@ import java.util.List;
@RunWith(Parameterized.class)
public class GraphCreationITCase extends MultipleProgramsTestBase {
- public GraphCreationITCase(TestExecutionMode mode){
+ public GraphCreationITCase(TestExecutionMode mode) {
super(mode);
}
-
- private String expectedResult;
+ private String expectedResult;
@Test
public void testCreateWithoutVertexValues() throws Exception {
- /*
- * Test create() with edge dataset and no vertex values
- */
+ /*
+ * Test create() with edge dataset and no vertex values
+ */
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, NullValue, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongEdgeData(env), env);
- DataSet<Vertex<Long, NullValue>> data = graph.getVertices();
- List<Vertex<Long, NullValue>> result= data.collect();
-
+ DataSet<Vertex<Long, NullValue>> data = graph.getVertices();
+ List<Vertex<Long, NullValue>> result = data.collect();
+
expectedResult = "1,(null)\n" +
- "2,(null)\n" +
- "3,(null)\n" +
- "4,(null)\n" +
- "5,(null)\n";
-
+ "2,(null)\n" +
+ "3,(null)\n" +
+ "4,(null)\n" +
+ "5,(null)\n";
+
compareResultAsTuples(result, expectedResult);
}
@Test
public void testCreateWithMapper() throws Exception {
- /*
- * Test create() with edge dataset and a mapper that assigns the id as value
- */
+ /*
+ * Test create() with edge dataset and a mapper that assigns the id as value
+ */
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongEdgeData(env),
- new AssignIdAsValueMapper(), env);
+ new AssignIdAsValueMapper(), env);
+
+ DataSet<Vertex<Long, Long>> data = graph.getVertices();
+ List<Vertex<Long, Long>> result = data.collect();
- DataSet<Vertex<Long, Long>> data = graph.getVertices();
- List<Vertex<Long, Long>> result= data.collect();
-
expectedResult = "1,1\n" +
- "2,2\n" +
- "3,3\n" +
- "4,4\n" +
- "5,5\n";
-
+ "2,2\n" +
+ "3,3\n" +
+ "4,4\n" +
+ "5,5\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -95,17 +94,17 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, DummyCustomParameterizedType<Double>, Long> graph = Graph.fromDataSet(
- TestGraphUtils.getLongLongEdgeData(env), new AssignCustomVertexValueMapper(), env);
+ TestGraphUtils.getLongLongEdgeData(env), new AssignCustomVertexValueMapper(), env);
+
+ DataSet<Vertex<Long, DummyCustomParameterizedType<Double>>> data = graph.getVertices();
+ List<Vertex<Long, DummyCustomParameterizedType<Double>>> result = data.collect();
- DataSet<Vertex<Long, DummyCustomParameterizedType<Double>>> data = graph.getVertices();
- List<Vertex<Long, DummyCustomParameterizedType<Double>>> result= data.collect();
-
expectedResult = "1,(2.0,0)\n" +
- "2,(4.0,1)\n" +
- "3,(6.0,2)\n" +
- "4,(8.0,3)\n" +
- "5,(10.0,4)\n";
-
+ "2,(4.0,1)\n" +
+ "3,(6.0,2)\n" +
+ "4,(8.0,3)\n" +
+ "5,(10.0,4)\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -122,12 +121,12 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
Boolean valid = graph.validate(new InvalidVertexIdsValidator<Long, Long, Long>());
//env.fromElements(result).writeAsText(resultPath);
-
- String res= valid.toString();//env.fromElements(valid);
- List<String> result= new LinkedList<>();
- result.add(res);
+
+ String res = valid.toString();//env.fromElements(valid);
+ List<String> result = new LinkedList<>();
+ result.add(res);
expectedResult = "true";
-
+
compareResultAsText(result, expectedResult);
}
@@ -142,13 +141,13 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
Graph<Long, Long, Long> graph = Graph.fromDataSet(vertices, edges, env);
Boolean valid = graph.validate(new InvalidVertexIdsValidator<Long, Long, Long>());
-
- String res= valid.toString();//env.fromElements(valid);
- List<String> result= new LinkedList<>();
- result.add(res);
+
+ String res = valid.toString();//env.fromElements(valid);
+ List<String> result = new LinkedList<>();
+ result.add(res);
expectedResult = "false\n";
-
+
compareResultAsText(result, expectedResult);
}
@@ -162,18 +161,18 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
Graph<Long, NullValue, NullValue> graph = Graph.fromTuple2DataSet(edges, env);
- List<Vertex<Long, NullValue>> result = graph.getVertices().collect();
-
+ List<Vertex<Long, NullValue>> result = graph.getVertices().collect();
+
expectedResult = "1,(null)\n" +
- "2,(null)\n" +
- "3,(null)\n" +
- "4,(null)\n" +
- "6,(null)\n" +
- "10,(null)\n" +
- "20,(null)\n" +
- "30,(null)\n" +
- "40,(null)\n" +
- "60,(null)\n";
+ "2,(null)\n" +
+ "3,(null)\n" +
+ "4,(null)\n" +
+ "6,(null)\n" +
+ "10,(null)\n" +
+ "20,(null)\n" +
+ "30,(null)\n" +
+ "40,(null)\n" +
+ "60,(null)\n";
compareResultAsTuples(result, expectedResult);
}
@@ -187,20 +186,20 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
DataSet<Tuple2<Long, Long>> edges = TestGraphUtils.getLongLongTuple2Data(env);
Graph<Long, String, NullValue> graph = Graph.fromTuple2DataSet(edges,
- new BooMapper(), env);
+ new BooMapper(), env);
+
+ List<Vertex<Long, String>> result = graph.getVertices().collect();
- List<Vertex<Long, String>> result = graph.getVertices().collect();
-
expectedResult = "1,boo\n" +
- "2,boo\n" +
- "3,boo\n" +
- "4,boo\n" +
- "6,boo\n" +
- "10,boo\n" +
- "20,boo\n" +
- "30,boo\n" +
- "40,boo\n" +
- "60,boo\n";
+ "2,boo\n" +
+ "3,boo\n" +
+ "4,boo\n" +
+ "6,boo\n" +
+ "10,boo\n" +
+ "20,boo\n" +
+ "30,boo\n" +
+ "40,boo\n" +
+ "60,boo\n";
compareResultAsTuples(result, expectedResult);
}
@@ -219,14 +218,16 @@ public class GraphCreationITCase extends MultipleProgramsTestBase {
DummyCustomParameterizedType<Double> dummyValue = new DummyCustomParameterizedType<>();
public DummyCustomParameterizedType<Double> map(Long vertexId) {
- dummyValue.setIntField(vertexId.intValue()-1);
- dummyValue.setTField(vertexId*2.0);
+ dummyValue.setIntField(vertexId.intValue() - 1);
+ dummyValue.setTField(vertexId * 2.0);
return dummyValue;
}
}
@SuppressWarnings("serial")
private static final class BooMapper implements MapFunction<Long, String> {
- public String map(Long value) { return "boo"; }
+ public String map(Long value) {
+ return "boo";
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flink/blob/cb282067/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
index f8eb874..148952c 100644
--- a/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
+++ b/flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/GraphCreationWithMapperITCase.java
@@ -36,12 +36,11 @@ import java.util.List;
@RunWith(Parameterized.class)
public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
- public GraphCreationWithMapperITCase(TestExecutionMode mode){
+ public GraphCreationWithMapperITCase(TestExecutionMode mode) {
super(mode);
}
- private String expectedResult;
-
+ private String expectedResult;
@Test
public void testWithDoubleValueMapper() throws Exception {
@@ -50,17 +49,17 @@ public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Double, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongEdgeData(env),
- new AssignDoubleValueMapper(), env);
+ new AssignDoubleValueMapper(), env);
+
+ DataSet<Vertex<Long, Double>> data = graph.getVertices();
+ List<Vertex<Long, Double>> result = data.collect();
- DataSet<Vertex<Long, Double>> data = graph.getVertices();
- List<Vertex<Long, Double>> result= data.collect();
-
expectedResult = "1,0.1\n" +
- "2,0.1\n" +
- "3,0.1\n" +
- "4,0.1\n" +
- "5,0.1\n";
-
+ "2,0.1\n" +
+ "3,0.1\n" +
+ "4,0.1\n" +
+ "5,0.1\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -71,39 +70,39 @@ public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, Tuple2<Long, Long>, Long> graph = Graph.fromDataSet(
- TestGraphUtils.getLongLongEdgeData(env), new AssignTuple2ValueMapper(), env);
+ TestGraphUtils.getLongLongEdgeData(env), new AssignTuple2ValueMapper(), env);
+
+ DataSet<Vertex<Long, Tuple2<Long, Long>>> data = graph.getVertices();
+ List<Vertex<Long, Tuple2<Long, Long>>> result = data.collect();
- DataSet<Vertex<Long, Tuple2<Long, Long>>> data = graph.getVertices();
- List<Vertex<Long, Tuple2<Long, Long>>> result= data.collect();
-
expectedResult = "1,(2,42)\n" +
- "2,(4,42)\n" +
- "3,(6,42)\n" +
- "4,(8,42)\n" +
- "5,(10,42)\n";
-
+ "2,(4,42)\n" +
+ "3,(6,42)\n" +
+ "4,(8,42)\n" +
+ "5,(10,42)\n";
+
compareResultAsTuples(result, expectedResult);
}
@Test
public void testWithConstantValueMapper() throws Exception {
- /*
- * Test create() with edge dataset with String key type
- * and a mapper that assigns a double constant as value
- */
- final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
- Graph<String, Double, Long> graph = Graph.fromDataSet(TestGraphUtils.getStringLongEdgeData(env),
+ /*
+ * Test create() with edge dataset with String key type
+ * and a mapper that assigns a double constant as value
+ */
+ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
+ Graph<String, Double, Long> graph = Graph.fromDataSet(TestGraphUtils.getStringLongEdgeData(env),
new AssignDoubleConstantMapper(), env);
- DataSet<Vertex<String, Double>> data = graph.getVertices();
- List<Vertex<String, Double>> result= data.collect();
-
- expectedResult = "1,0.1\n" +
+ DataSet<Vertex<String, Double>> data = graph.getVertices();
+ List<Vertex<String, Double>> result = data.collect();
+
+ expectedResult = "1,0.1\n" +
"2,0.1\n" +
"3,0.1\n" +
"4,0.1\n" +
"5,0.1\n";
-
+
compareResultAsTuples(result, expectedResult);
}
@@ -114,17 +113,17 @@ public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
Graph<Long, DummyCustomType, Long> graph = Graph.fromDataSet(
- TestGraphUtils.getLongLongEdgeData(env), new AssignCustomValueMapper(), env);
+ TestGraphUtils.getLongLongEdgeData(env), new AssignCustomValueMapper(), env);
+
+ DataSet<Vertex<Long, DummyCustomType>> data = graph.getVertices();
+ List<Vertex<Long, DummyCustomType>> result = data.collect();
- DataSet<Vertex<Long, DummyCustomType>> data = graph.getVertices();
- List<Vertex<Long, DummyCustomType>> result= data.collect();
-
expectedResult = "1,(F,0)\n" +
- "2,(F,1)\n" +
- "3,(F,2)\n" +
- "4,(F,3)\n" +
- "5,(F,4)\n";
-
+ "2,(F,1)\n" +
+ "3,(F,2)\n" +
+ "4,(F,3)\n" +
+ "5,(F,4)\n";
+
compareResultAsTuples(result, expectedResult);
}
@@ -138,7 +137,7 @@ public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
@SuppressWarnings("serial")
private static final class AssignTuple2ValueMapper implements MapFunction<Long, Tuple2<Long, Long>> {
public Tuple2<Long, Long> map(Long vertexId) {
- return new Tuple2<>(vertexId*2, 42L);
+ return new Tuple2<>(vertexId * 2, 42L);
}
}
@@ -152,7 +151,7 @@ public class GraphCreationWithMapperITCase extends MultipleProgramsTestBase {
@SuppressWarnings("serial")
private static final class AssignCustomValueMapper implements MapFunction<Long, DummyCustomType> {
public DummyCustomType map(Long vertexId) {
- return new DummyCustomType(vertexId.intValue()-1, false);
+ return new DummyCustomType(vertexId.intValue() - 1, false);
}
}
}