Github user ankurdave commented on a diff in the pull request:
https://github.com/apache/spark/pull/2815#discussion_r19708325
--- Diff:
graphx/src/main/scala/org/apache/spark/graphx/impl/GraphImpl.scala ---
@@ -127,26 +127,26 @@ class GraphImpl[VD: ClassTag, ED: ClassTag] protected
(
}
override def mapTriplets[ED2: ClassTag](
- f: (PartitionID, Iterator[EdgeTriplet[VD, ED]]) => Iterator[ED2]):
Graph[VD, ED2] = {
+ f: (PartitionID, Iterator[EdgeTriplet[VD, ED]]) => Iterator[ED2],
+ tripletFields: TripletFields): Graph[VD, ED2] = {
vertices.cache()
- val mapUsesSrcAttr = accessesVertexAttr(f, "srcAttr")
- val mapUsesDstAttr = accessesVertexAttr(f, "dstAttr")
- replicatedVertexView.upgrade(vertices, mapUsesSrcAttr, mapUsesDstAttr)
+ replicatedVertexView.upgrade(vertices, tripletFields.useSrc,
tripletFields.useDst)
val newEdges = replicatedVertexView.edges.mapEdgePartitions { (pid,
part) =>
- part.map(f(pid, part.tripletIterator(mapUsesSrcAttr,
mapUsesDstAttr)))
+ part.map(f(pid, part.tripletIterator(tripletFields.useSrc,
tripletFields.useDst)))
}
new GraphImpl(vertices, replicatedVertexView.withEdges(newEdges))
}
override def subgraph(
epred: EdgeTriplet[VD, ED] => Boolean = x => true,
- vpred: (VertexId, VD) => Boolean = (a, b) => true): Graph[VD, ED] = {
+ vpred: (VertexId, VD) => Boolean = (a, b) => true,
+ tripletFields: TripletFields = TripletFields.All): Graph[VD, ED] = {
vertices.cache()
// Filter the vertices, reusing the partitioner and the index from
this graph
val newVerts = vertices.mapVertexPartitions(_.filter(vpred))
// Filter the triplets. We must always upgrade the triplet view fully
because vpred always runs
// on both src and dst vertices
- replicatedVertexView.upgrade(vertices, true, true)
+ replicatedVertexView.upgrade(vertices, tripletFields.useSrc,
tripletFields.useDst)
--- End diff --
I don't think this change is correct - see the comment on the line above.
---
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]