You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by James <al...@gmail.com> on 2015/03/15 08:54:47 UTC

Null Pointer Exception due to mapVertices function in GraphX

I have got NullPointerException in aggregateMessages on a graph which is
the output of mapVertices function of a graph. I found the problem is
because of the mapVertices funciton did not affect all the triplet of the
graph.

// Initial the graph, assign a counter to each vertex that contains
the vertex id onlyvar anfGraph = graph.mapVertices { case (vid, _) =>
>   val counter = new HyperLogLog(5)
>   counter.offer(vid)
>   counter}
> val nullVertex = anfGraph.triplets.filter(edge => edge.srcAttr == null).first// There is an edge whose src attr is null
>
> anfGraph.vertices.filter(_._1 == nullVertex).first// I could see that the vertex has a not null attribute
>
> messages = anfGraph.aggregateMessages(msgFun, mergeMessage)   // <- NullPointerException
>
>
My spark version:1.2.0