diff options
author | Ankur Dave <ankurdave@gmail.com> | 2014-06-05 23:33:12 -0700 |
---|---|---|
committer | Reynold Xin <rxin@apache.org> | 2014-06-05 23:33:12 -0700 |
commit | 8d85359f84cc67996b4bcf1670a8a98ab4f914a2 (patch) | |
tree | 4d0be1cb9104031c56b14bbceb4c824eace3c6cd /streaming | |
parent | 41db44c428a10f4453462d002d226798bb8fbdda (diff) | |
download | spark-8d85359f84cc67996b4bcf1670a8a98ab4f914a2.tar.gz spark-8d85359f84cc67996b4bcf1670a8a98ab4f914a2.tar.bz2 spark-8d85359f84cc67996b4bcf1670a8a98ab4f914a2.zip |
[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 requesting that the compiler generate evidence of equality between the old and new vertex attribute types, and providing a default value for the evidence parameter if the two types are not equal. The methods can then check the value of the evidence parameter to see whether the types are equal.
It also adds a test called "mapVertices changing type with same erased type" that failed before the PR and succeeds now.
Callers of mapVertices and outerJoinVertices can no longer use a wildcard for a graph's VD type. To avoid "Error occurred in an application involving default arguments," they must bind VD to a type parameter, as this PR does for ShortestPaths and LabelPropagation.
Author: Ankur Dave <ankurdave@gmail.com>
Closes #967 from ankurdave/SPARK-1552 and squashes the following commits:
68a4fff [Ankur Dave] Undo conserve naming
7388705 [Ankur Dave] Remove unnecessary ClassTag for VD parameters
a704e5f [Ankur Dave] Use type equality constraint with default argument
29a5ab7 [Ankur Dave] Add failing test
f458c83 [Ankur Dave] Revert "[SPARK-1552] Fix type comparison bug in mapVertices and outerJoinVertices"
16d6af8 [Ankur Dave] [SPARK-1552] Fix type comparison bug in mapVertices and outerJoinVertices
Diffstat (limited to 'streaming')
0 files changed, 0 insertions, 0 deletions