You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/01/31 02:45:40 UTC

[GitHub] huonw commented on a change in pull request #23681: [SPARK-26757][GraphX] Return 0 for `count` on empty Edge/Vertex RDDs

huonw commented on a change in pull request #23681: [SPARK-26757][GraphX] Return 0 for `count` on empty Edge/Vertex RDDs
URL: https://github.com/apache/spark/pull/23681#discussion_r252518240
 
 

 ##########
 File path: graphx/src/main/scala/org/apache/spark/graphx/impl/EdgeRDDImpl.scala
 ##########
 @@ -87,7 +87,7 @@ class EdgeRDDImpl[ED: ClassTag, VD: ClassTag] private[graphx] (
 
   /** The number of edges in the RDD. */
   override def count(): Long = {
-    partitionsRDD.map(_._2.size.toLong).reduce(_ + _)
+    partitionsRDD.map(_._2.size.toLong).fold(0)(_ + _)
 
 Review comment:
   Indeed it does. I've switched that to `fold` too.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org