我正在通过教程 http://ampcamp.berkeley.edu/big-data-mini-course/graph-analytics-with-graphx.html
在某些时候,我们使用 mapReduceTriplets 操作。这将返回预期结果
// Find the oldest follower for each user
val oldestFollower: VertexRDD[(String, Int)] = userGraph.mapReduceTriplets[(String, Int)](
// For each edge send a message to the destination vertex with the attribute of the source vertex
edge => Iterator((edge.dstId, (edge.srcAttr.name, edge.srcAttr.age))),
// To combine messages take the message for the older follower
(a, b) => if (a._2 > b._2) a else b
)
但是 IntelliJ 指出 mapReduceTriplets 已被弃用(从 1.2.0 开始),应该由 aggregateMessages 替换
// Find the oldest follower for each user
val oldestFollower: VertexRDD[(String, Int)] = userGraph.aggregateMessages()[(String, Int)](
// For each edge send a message to the destination vertex with the attribute of the source vertex
edge => Iterator((edge.dstId, (edge.srcAttr.name, edge.srcAttr.age))),
// To combine messages take the message for the older follower
(a, b) => if (a._2 > b._2) a else b
)
所以我运行完全相同的代码,但没有任何输出。这是预期的结果还是我应该因为聚合消息的变化而改变一些东西?