GitHub user ankurdave opened a pull request:
https://github.com/apache/spark/pull/967
[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.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ankurdave/spark SPARK-1552
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/967.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #967
----
commit 16d6af8ef3eb20e88452db3cca1cdc307697b1c0
Author: Ankur Dave <[email protected]>
Date: 2014-06-04T01:50:35Z
[SPARK-1552] Fix type comparison bug in mapVertices and outerJoinVertices
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.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---