Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class AggregateMessagesSuite extends SparkFunSuite with GraphFrameTestSparkConte
case _: Row => throw new GraphFramesUnreachableException()
}
.toMap
agg.unpersist()
// Compute the truth via brute force for comparison.
val trueAgg: Map[String, Int] = {
val user2age = g.vertices
Expand Down Expand Up @@ -97,6 +98,7 @@ class AggregateMessagesSuite extends SparkFunSuite with GraphFrameTestSparkConte
case _: Row => throw new GraphFramesUnreachableException()
}
.toMap
agg2.unpersist()
// Compare to the true values.
agg2Map.keys.foreach { case user =>
assert(agg2Map(user) === trueAgg(user), s"Failure on user $user")
Expand Down Expand Up @@ -171,5 +173,8 @@ class AggregateMessagesSuite extends SparkFunSuite with GraphFrameTestSparkConte
assert(output1 === expectedValues)
assert(output2 === expectedValues)
assert(output3 === expectedValues)
agg.unpersist()
agg2.unpersist()
agg3.unpersist()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class DetectingCyclesSuite extends SparkFunSuite with GraphFrameTestSparkContext
assert(collected(0) == Seq(1, 2, 3, 1))
assert(collected(1) == Seq(2, 3, 1, 2))
assert(collected(2) == Seq(3, 1, 2, 3))
res.unpersist()
}

test("test no cycles") {
Expand All @@ -40,6 +41,7 @@ class DetectingCyclesSuite extends SparkFunSuite with GraphFrameTestSparkContext
.toDF("src", "dst"))
val res = graph.detectingCycles.setUseLocalCheckpoints(true).run()
assert(res.count() == 0)
res.unpersist()
}

test("test multiple cycles from one source") {
Expand All @@ -65,5 +67,6 @@ class DetectingCyclesSuite extends SparkFunSuite with GraphFrameTestSparkContext
assert(collected(4) == Seq(2, 5, 1, 2))
assert(collected(5) == Seq(3, 1, 3))
assert(collected(6) == Seq(5, 1, 2, 5))
res.unpersist()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ class LabelPropagationSuite extends SparkFunSuite with GraphFrameTestSparkContex
labels.filter(s"id >= $n").select("label").collect().toSeq.map(_.getLong(0)).toSet
assert(clique2.size === 1)
assert(clique1 !== clique2)
labels.unpersist()
}
}
3 changes: 3 additions & 0 deletions core/src/test/scala/org/graphframes/lib/PageRankSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class PageRankSuite extends SparkFunSuite with GraphFrameTestSparkContext {
TestUtils.testSchemaInvariants(g, pr)
TestUtils.checkColumnType(pr.vertices.schema, "pagerank", DataTypes.DoubleType)
TestUtils.checkColumnType(pr.edges.schema, "weight", DataTypes.DoubleType)
pr.unpersist()
}

test("friends graph with personalized PageRank") {
Expand All @@ -48,6 +49,7 @@ class PageRankSuite extends SparkFunSuite with GraphFrameTestSparkContext {
assert(
gRank === 0.0,
s"User g (Gabby) doesn't connect with a. So its pagerank should be 0 but we got $gRank.")
results.unpersist()
}

test("graph with three disconnected components") {
Expand Down Expand Up @@ -75,5 +77,6 @@ class PageRankSuite extends SparkFunSuite with GraphFrameTestSparkContext {
val originalIds = v.select("id").collect().map(_.getLong(0)).toSet
val resultIds = results.vertices.select("id").collect().map(_.getLong(0)).toSet
assert(originalIds === resultIds, "PageRank results should preserve all vertex IDs")
results.unpersist()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ParallelPersonalizedPageRankSuite extends SparkFunSuite with GraphFrameTes
TestUtils.testSchemaInvariants(g, pr)
TestUtils.checkColumnType(pr.vertices.schema, "pageranks", SQLDataTypes.VectorType)
TestUtils.checkColumnType(pr.edges.schema, "weight", DataTypes.DoubleType)
pr.unpersist()
}

test("friends graph with parallel personalized PageRank") {
Expand Down Expand Up @@ -96,5 +97,6 @@ class ParallelPersonalizedPageRankSuite extends SparkFunSuite with GraphFrameTes
assert(
gRank.numNonzeros === 0,
s"User g (Gabby) doesn't connect with a. So its pagerank should be 0 but we got ${gRank.numNonzeros}.")
pr.unpersist()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ class SVDPlusPlusSuite extends SparkFunSuite with GraphFrameTestSparkContext {
}
.reduce(_ + _) / g.edges.count()
assert(err <= svdppErr)
v2.unpersist()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class ShortestPathsSuite extends SparkFunSuite with GraphFrameTestSparkContext {
DataTypes.createMapType(v2.schema("id").dataType, DataTypes.IntegerType, false))
val results = v2.collect().toSet
assert(results === expected)
v2.unpersist()
()
}

Expand Down Expand Up @@ -105,6 +106,7 @@ class ShortestPathsSuite extends SparkFunSuite with GraphFrameTestSparkContext {
case _ => throw new GraphFramesUnreachableException()
}
assert(results.toSet === shortestPaths)
v2.unpersist()
}

test("friends graph") {
Expand All @@ -128,6 +130,7 @@ class ShortestPathsSuite extends SparkFunSuite with GraphFrameTestSparkContext {
}
.toSet
assert(results === expected)
v.unpersist()
}

test("friends graph with GraphFrames") {
Expand All @@ -151,6 +154,7 @@ class ShortestPathsSuite extends SparkFunSuite with GraphFrameTestSparkContext {
}
.toSet
assert(results === expected)
v.unpersist()
}
test("Test vertices with column name") {
val verticeSeq =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ class StronglyConnectedComponentsSuite extends SparkFunSuite with GraphFrameTest
for (Row(id: Long, component: Long, _) <- c.select("id", "component", "value").collect()) {
assert(id === component)
}
c.unpersist()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TriangleCountSuite extends SparkFunSuite with GraphFrameTestSparkContext {
case Row(_: Long, count: Long, _) => assert(count === 1)
case _: Row => throw new GraphFramesUnreachableException()
}
v2.unpersist()
}

test("Count two triangles") {
Expand All @@ -62,6 +63,7 @@ class TriangleCountSuite extends SparkFunSuite with GraphFrameTestSparkContext {
}
case _: Row => throw new GraphFramesUnreachableException()
}
v2.unpersist()
}

test("Count one triangles with bi-directed edges") {
Expand All @@ -80,6 +82,7 @@ class TriangleCountSuite extends SparkFunSuite with GraphFrameTestSparkContext {
}
case _: Row => throw new GraphFramesUnreachableException()
}
v2.unpersist()
}

test("Count a single triangle with duplicate edges") {
Expand All @@ -95,6 +98,7 @@ class TriangleCountSuite extends SparkFunSuite with GraphFrameTestSparkContext {
assert(count === 1)
case _: Row => throw new GraphFramesUnreachableException()
}
v2.unpersist()
}

test("Count with dot column name") {
Expand All @@ -112,6 +116,7 @@ class TriangleCountSuite extends SparkFunSuite with GraphFrameTestSparkContext {
case Row(_: Long, count: Long, _) => assert(count === 1)
case _: Row => throw new GraphFramesUnreachableException()
}
v2.unpersist()
}

test("Count with backquote in column name") {
Expand All @@ -129,6 +134,7 @@ class TriangleCountSuite extends SparkFunSuite with GraphFrameTestSparkContext {
case Row(_: Long, count: Long, _) => assert(count === 1)
case _: Row => throw new GraphFramesUnreachableException()
}
v2.unpersist()
}

test("no triangle") {
Expand All @@ -140,5 +146,6 @@ class TriangleCountSuite extends SparkFunSuite with GraphFrameTestSparkContext {
assert(count === 0)
case _: Row => throw new GraphFramesUnreachableException()
}
v2.unpersist()
}
}