Skip to content
Closed
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
2 changes: 1 addition & 1 deletion graphx/src/main/scala/org/apache/spark/graphx/Pregel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ object Pregel extends Logging {
// count the iteration
i += 1
}

messages.unpersist(blocking = false)
g
} // end of apply

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ object ConnectedComponents {
}
}
val initialMessage = Long.MaxValue
Pregel(ccGraph, initialMessage, activeDirection = EdgeDirection.Either)(
val pregelGraph = Pregel(ccGraph, initialMessage, activeDirection = EdgeDirection.Either)(
vprog = (id, attr, msg) => math.min(attr, msg),
sendMsg = sendMessage,
mergeMsg = (a, b) => math.min(a, b))
ccGraph.unpersist()
pregelGraph
} // end of connectedComponents
}
16 changes: 16 additions & 0 deletions graphx/src/test/scala/org/apache/spark/graphx/GraphSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -428,4 +428,20 @@ class GraphSuite extends SparkFunSuite with LocalSparkContext {
}
}

test("unpersist graph RDD") {
withSpark { sc =>
val vert = sc.parallelize(List((1L, "a"), (2L, "b"), (3L, "c")), 1)
val edges = sc.parallelize(List(Edge[Long](1L, 2L), Edge[Long](1L, 3L)), 1)
val g0 = Graph(vert, edges)
val g = g0.partitionBy(PartitionStrategy.EdgePartition2D, 2)
val cc = g.connectedComponents()
assert(sc.getPersistentRDDs.nonEmpty)
cc.unpersist()
g.unpersist()
g0.unpersist()
vert.unpersist()
edges.unpersist()
assert(sc.getPersistentRDDs.isEmpty)
}
}
}