You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by ankurdave <an...@gmail.com> on 2014/03/19 02:49:18 UTC

Re: There is an error in Graphx

This problem occurs because graph.triplets generates an iterator that reuses
the same EdgeTriplet object for every triplet in the partition. The
workaround is to force a copy using graph.triplets.map(_.copy()).

The solution in the AMPCamp tutorial is mistaken -- I'm not sure if that
ever worked.



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/There-is-an-error-in-Graphx-tp1575p2836.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

Re: There is an error in Graphx

Posted by ankurdave <an...@gmail.com>.
> The workaround is to force a copy using graph.triplets.map(_.copy()).

Sorry, this actually won't copy the entire triplet, only the attributes
defined in Edge. The right workaround is to copy the EdgeTriplet explicitly:

graph.triplets.map { et =>
  val et2 = new EdgeTriplet[VD, ED]   // Replace VD and ED with the correct
types
  et2.srcId = et.srcId
  et2.dstId = et.dstId
  et2.attr = et.attr
  et2.srcAttr = et.srcAttr
  et2.dstAttr = et.dstAttr
  et2
}



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/There-is-an-error-in-Graphx-tp1575p2837.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.