Repository: spark Updated Branches: refs/heads/master 792507128 -> d806ed343
[SPARK-13416][GraphX] Add positive check for option 'numIter' in StronglyConnectedComponents JIRA: https://issues.apache.org/jira/browse/SPARK-13416 ## What changes were proposed in this pull request? The output of StronglyConnectedComponents with numIter no greater than 1 may make no sense. So I just add require check in it. ## How was the this patch tested? unit tests passed Author: Zheng RuiFeng <ruife...@foxmail.com> Closes #11284 from zhengruifeng/scccheck. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d806ed34 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d806ed34 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d806ed34 Branch: refs/heads/master Commit: d806ed34365aa27895547297fff4cc48ecbeacdf Parents: 7925071 Author: Zheng RuiFeng <ruife...@foxmail.com> Authored: Sun Feb 21 00:53:15 2016 -0800 Committer: Reynold Xin <r...@databricks.com> Committed: Sun Feb 21 00:53:15 2016 -0800 ---------------------------------------------------------------------- .../org/apache/spark/graphx/lib/StronglyConnectedComponents.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/d806ed34/graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala ---------------------------------------------------------------------- diff --git a/graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala b/graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala index 8dd9580..7063137 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala @@ -36,7 +36,7 @@ object StronglyConnectedComponents { * @return a graph with vertex attributes containing the smallest vertex id in each SCC */ def run[VD: ClassTag, ED: ClassTag](graph: Graph[VD, ED], numIter: Int): Graph[VertexId, ED] = { - + require(numIter > 0, s"Number of iterations ${numIter} must be greater than 0.") // the graph we update with final SCC ids, and the graph we return at the end var sccGraph = graph.mapVertices { case (vid, _) => vid } // graph we are going to work with in our iterations --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org