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