apache/spark — pull request #967 by ankurdave (2014-06-04 03:35:36+00:00)
Title: [SPARK-1552] Fix type comparison bug in {map,outerJoin}Vertices

In GraphImpl, mapVertices and outerJoinVertices use a more efficient implementation when the map function conserves vertex attribute types. This is implemented by comparing the ClassTags of the old and new vertex attribute types. However, ClassTags store erased types, so the comparison will return a false positive for types with different type parameters, such as Option[Int] and Option[Double].

This PR resolves the problem by unconditionally using the general implementation in mapVertices and outerJoinVertices, and introducing "Conserve" variants of these methods that enforce type equality and use the more efficient implementation.

It also adds a test called "mapVertices changing type with same erased type" that failed before the PR and succeeds now.

The "Conserve" naming comes from Scala's `List#mapConserve` method.