diff options
author | Takeshi YAMAMURO <linguin.m.s@gmail.com> | 2015-03-16 23:54:54 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2015-03-16 23:54:54 -0700 |
commit | b3e6eca81f79ba3c9205211797fa825b199bac83 (patch) | |
tree | 0b6a5f18efc2ae3cfa8af343de6a1aec7f1e0fc7 /graphx/src/main | |
parent | 68707225f1a4081aadbf0fd7e6221293a190529b (diff) | |
download | spark-b3e6eca81f79ba3c9205211797fa825b199bac83.tar.gz spark-b3e6eca81f79ba3c9205211797fa825b199bac83.tar.bz2 spark-b3e6eca81f79ba3c9205211797fa825b199bac83.zip |
[SPARK-6357][GraphX] Add unapply in EdgeContext
This extractor is mainly used for Graph#aggregateMessages*.
Author: Takeshi YAMAMURO <linguin.m.s@gmail.com>
Closes #5047 from maropu/AddUnapplyInEdgeContext and squashes the following commits:
87e04df [Takeshi YAMAMURO] Add unapply in EdgeContext
Diffstat (limited to 'graphx/src/main')
-rw-r--r-- | graphx/src/main/scala/org/apache/spark/graphx/EdgeContext.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/graphx/src/main/scala/org/apache/spark/graphx/EdgeContext.scala b/graphx/src/main/scala/org/apache/spark/graphx/EdgeContext.scala index f70715fca6..d8be02e202 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/EdgeContext.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/EdgeContext.scala @@ -49,3 +49,20 @@ abstract class EdgeContext[VD, ED, A] { et } } + +object EdgeContext { + + /** + * Extractor mainly used for Graph#aggregateMessages*. + * Example: + * {{{ + * val messages = graph.aggregateMessages( + * case ctx @ EdgeContext(_, _, _, _, attr) => + * ctx.sendToDst(attr) + * , _ + _) + * }}} + */ + def unapply[VD, ED, A](edge: EdgeContext[VD, ED, A]) = + Some(edge.srcId, edge.dstId, edge.srcAttr, edge.dstAttr, edge.attr) +} + |