Github user krcz commented on a diff in the pull request:
https://github.com/apache/spark/pull/6685#discussion_r34936041
--- Diff:
graphx/src/main/scala/org/apache/spark/graphx/impl/GraphImpl.scala ---
@@ -178,6 +178,39 @@ class GraphImpl[VD: ClassTag, ED: ClassTag] protected (
new GraphImpl(newVerts, replicatedVertexView.withEdges(newEdges))
}
+ override def union[VD2: ClassTag, ED2: ClassTag, VD3: ClassTag, ED3:
ClassTag] (
+ other: Graph[VD2, ED2],
+ mergeSameVertexAttr: (Option[VD], Option[VD2]) => VD3,
+ mergeSameEdgeAttr: (Option[ED], Option[ED2]) => ED3): Graph[VD3, ED3]
= {
+
+ val newVertexRDD: RDD[(VertexId, VD3)] =
vertices.fullOuterJoin(other.vertices).map {
+ pair => (pair._1, mergeSameVertexAttr(pair._2._1, pair._2._2))
+ }.cache()
+
+ // convert other EdgeRDD to kv pair RDD
+ val otherPair = other.edges.mapPartitions {
+ iter => iter.map { edge => (edge.srcId.toString +
edge.dstId.toString, edge) }
--- End diff --
I believe you should add some delimiter when concatenating. Otherwise two
different edges can be glued together (i.e. 1 -> 12 and 11 -> 2).
---
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.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]