spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deborah Siegel <deborah.sie...@gmail.com>
Subject documentation - graphx-programming-guide error?
Date Mon, 02 Mar 2015 07:12:10 GMT
Hello,

I am running through examples given on
http://spark.apache.org/docs/1.2.1/graphx-programming-guide.html

The section for Map Reduce Triplets Transition Guide (Legacy) indicates
that one can run the following .aggregateMessages code

val graph: Graph[Int, Float] = ...
def msgFun(triplet: EdgeContext[Int, Float, String]) {
triplet.sendToDst("Hi") }
def reduceFun(a: Int, b: Int): Int = a + b
val result = graph.aggregateMessages[String](msgFun, reduceFun)

I created a graph of the indicated type, and get an error

scala> val result = graph.aggregateMessages[String](msgFun, reduceFun)
<console>:23: error: type mismatch;
found   : Int
required: String
Error occurred in an application involving default arguments.
val result = graph.aggregateMessages[String](msgFun, reduceFun)

              ^
What is this example supposed to do? The following would work, although
I'll admit I am perplexed by the example's intent.

def msgFun(triplet: EdgeContext[Int, Float, (Int,String)]) {
  triplet.sendToDst(1, "Hi")
}
def reduceFun(a: (Int,String), b: (Int,String)): (Int,String) = ((a._1 +
b._1),a._2)
val result = graph.aggregateMessages[(Int,String)](msgFun, reduceFun)

Sincerely,
Deb

Mime
View raw message