aboutsummaryrefslogtreecommitdiff
path: root/docs/graphx-programming-guide.md
diff options
context:
space:
mode:
authorDEBORAH SIEGEL <deborahsiegel@DEBORAHs-MacBook-Pro.local>2015-03-02 10:15:32 -0800
committerReynold Xin <rxin@databricks.com>2015-03-02 10:15:32 -0800
commite7d8ae444fead27fe85a879f2f7a4cfdd8c47b16 (patch)
treef477c3b649d08aa5af273699b206fb93ab5e1508 /docs/graphx-programming-guide.md
parent9ce12aaf283a2793e719bdc956dd858922636e8d (diff)
downloadspark-e7d8ae444fead27fe85a879f2f7a4cfdd8c47b16.tar.gz
spark-e7d8ae444fead27fe85a879f2f7a4cfdd8c47b16.tar.bz2
spark-e7d8ae444fead27fe85a879f2f7a4cfdd8c47b16.zip
aggregateMessages example in graphX doc
Examples illustrating difference between legacy mapReduceTriplets usage and aggregateMessages usage has type issues on the reduce for both operators. Being just an example- changed example to reduce the message String by concatenation. Although non-optimal for performance. Author: DEBORAH SIEGEL <deborahsiegel@DEBORAHs-MacBook-Pro.local> Closes #4853 from d3borah/master and squashes the following commits: db54173 [DEBORAH SIEGEL] fixed aggregateMessages example in graphX doc
Diffstat (limited to 'docs/graphx-programming-guide.md')
-rw-r--r--docs/graphx-programming-guide.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/graphx-programming-guide.md b/docs/graphx-programming-guide.md
index 28bdf81ca0..c601d793a2 100644
--- a/docs/graphx-programming-guide.md
+++ b/docs/graphx-programming-guide.md
@@ -663,7 +663,7 @@ val graph: Graph[Int, Float] = ...
def msgFun(triplet: Triplet[Int, Float]): Iterator[(Int, String)] = {
Iterator((triplet.dstId, "Hi"))
}
-def reduceFun(a: Int, b: Int): Int = a + b
+def reduceFun(a: String, b: String): String = a + " " + b
val result = graph.mapReduceTriplets[String](msgFun, reduceFun)
{% endhighlight %}
@@ -674,7 +674,7 @@ val graph: Graph[Int, Float] = ...
def msgFun(triplet: EdgeContext[Int, Float, String]) {
triplet.sendToDst("Hi")
}
-def reduceFun(a: Int, b: Int): Int = a + b
+def reduceFun(a: String, b: String): String = a + " " + b
val result = graph.aggregateMessages[String](msgFun, reduceFun)
{% endhighlight %}