srowen 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_r252516119
##########
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:
Oh nice catch, yeah. I searched for other "reduce" calls but didn't hit this
one.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]