Github user jegonzal commented on the pull request:

    https://github.com/apache/spark/pull/1217#issuecomment-47204112
  
    @ankurdave and @rxin there is an issue with the current API.  The 
`sendMessage` function pull the active field out of the vertex value here:
    
https://github.com/apache/spark/pull/1217/files#diff-e399679417ffa6eeedf26a7630baca16R243
    ```scala
    def sendMessageWrapper(triplet: EdgeTriplet[(VD, Boolean),ED]): 
Iterator[(VertexId, A)] = {
      val simpleTriplet = new EdgeTriplet[VD, ED]()
       simpleTriplet.set(triplet)
       simpleTriplet.srcAttr = triplet.srcAttr._1
       simpleTriplet.dstAttr = triplet.dstAttr._1
       val ctx = new EdgeContext(i, triplet.srcAttr._2, triplet.dstAttr._2)
       sendMsg(simpleTriplet, ctx)
     }
    // Compute the messages for all the active vertices
    val messages = g.mapReduceTriplets(sendMessageWrapper, mergeMsg, 
Some((activeVertices, activeDirection)))
    ```
    thereby allowing the user a simple `sendMsg` interface:
    ```scala
    sendMsg: (EdgeTriplet[VD, ED], EdgeContext) => Iterator[(VertexId, A)]
    ```
    However because we access the source and destination vertex attributes the 
byte code inspection will force a full 3-way join even if the user doesn't 
actually read the fields. 
    
    The simplest solution would be to change the send message interface to 
operate on the extended vertex attribute passing (containing the active field).
    ```scala
    sendMsg: (EdgeTriplet[(VD, Boolean), ED], EdgeContext) => 
Iterator[(VertexId, A)]
    ```
    



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to