1. [SPARK-26757][GRAPHX] Return 0 for `count` on empty Edge/Vertex RDDs (details)
Commit 537d15ca5edb0f21ce2a15b30866a53675f90382 by sean.owen
[SPARK-26757][GRAPHX] Return 0 for `count` on empty Edge/Vertex RDDs
## What changes were proposed in this pull request?
Previously a "java.lang.UnsupportedOperationException: empty collection"
exception would be thrown due to using `reduce`, rather than `fold` or
similar that can tolerate empty RDDs.
This behaviour has existed for the Vertex RDDs since it was introduced
in b30e0ae0351be1cbc0b1cf179293587b466ee026. It seems this behaviour was
inherited by the Edge RDDs via copy-paste in
## How was this patch tested?
Two new unit tests.
Closes #23681 from huonw/empty-graphx.
Authored-by: Huon Wilson <> Signed-off-by:
Sean Owen <>
(cherry picked from commit da526985c7574dccdcc0cca7452e2e999a5b3012)
Signed-off-by: Sean Owen <>
The file was modifiedgraphx/src/test/scala/org/apache/spark/graphx/EdgeRDDSuite.scala (diff)
The file was modifiedgraphx/src/test/scala/org/apache/spark/graphx/VertexRDDSuite.scala (diff)
The file was modifiedgraphx/src/main/scala/org/apache/spark/graphx/impl/VertexRDDImpl.scala (diff)
The file was modifiedgraphx/src/test/scala/org/apache/spark/graphx/lib/SVDPlusPlusSuite.scala (diff)
The file was modifiedgraphx/src/main/scala/org/apache/spark/graphx/impl/EdgeRDDImpl.scala (diff)
The file was modifiedgraphx/src/main/scala/org/apache/spark/graphx/lib/SVDPlusPlus.scala (diff)