Skip to content

Commit 6a35ea8

Browse files
committed
[TEST] VertexRDD.apply mergeFunc
1 parent 4fbc29c commit 6a35ea8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

graphx/src/test/scala/org/apache/spark/graphx/VertexRDDSuite.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,21 @@ class VertexRDDSuite extends FunSuite with LocalSparkContext {
9999
}
100100
}
101101

102+
test("mergeFunc") {
103+
// test to see if the mergeFunc is working correctly
104+
withSpark { sc =>
105+
// VertexRDD default constructor: Duplicate entries are removed arbitrarily.
106+
// val verts = VertexRDD(sc.parallelize(List((0L, 1), (0L, 2), (1L, 3), (1L, 3), (1L, 3))))
107+
// ensure constructor preserve duplicate vertex
108+
// assert(verts.collect.toSet == Set((0L, 1), (0L, 2), (1L, 3), (1L, 3), (1L, 3)))
109+
// won't pass
110+
111+
val verts = sc.parallelize(List((0L, 1), (0L, 2), (1L, 3), (1L, 3), (1L, 3)))
112+
val edges = EdgeRDD.fromEdges(sc.parallelize(List.empty[Edge[Int]]))
113+
val rdd = VertexRDD(verts, edges, 0, (a: Int, b: Int) => a + b)
114+
// test merge function
115+
assert(rdd.collect.toSet == Set((0L, 3), (1L, 9)))
116+
}
117+
}
118+
102119
}

0 commit comments

Comments
 (0)