Github user ankurdave commented on a diff in the pull request:
https://github.com/apache/spark/pull/967#discussion_r13372714
--- Diff: graphx/src/main/scala/org/apache/spark/graphx/Graph.scala ---
@@ -131,6 +131,19 @@ abstract class Graph[VD: ClassTag, ED: ClassTag]
protected () extends Serializab
def mapVertices[VD2: ClassTag](map: (VertexId, VD) => VD2): Graph[VD2,
ED]
/**
+ * Transforms each vertex attribute in the graph using the map function.
Like [[mapVertices]], but
+ * since the type is conserved, is able to avoid moving unchanged vertex
attributes when updating
+ * the triplets view.
+ *
+ * @note The new graph has the same structure. As a consequence the
underlying index structures
+ * can be reused.
+ *
+ * @param map the function from a vertex object to a new vertex value of
the same type
+ *
+ */
+ def mapVerticesConserve(map: (VertexId, VD) => VD): Graph[VD, ED]
--- End diff --
Are you saying to detect whether it's correct to conserve by comparing
ClassTags? That's the point of the change -- comparing ClassTags can give a
false positive when the type is erased (i.e., classTag[Option[Int]] ==
classTag[Option[String]]), so it's unsafe to rely on it. See
https://issues.apache.org/jira/browse/SPARK-1552.
---
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.
---