You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Ankur Dave (JIRA)" <ji...@apache.org> on 2014/06/04 05:40:01 UTC

[jira] [Commented] (SPARK-1552) GraphX performs type comparison incorrectly

    [ https://issues.apache.org/jira/browse/SPARK-1552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14017340#comment-14017340 ] 

Ankur Dave commented on SPARK-1552:
-----------------------------------

Proposed fix: https://github.com/apache/spark/pull/967

> GraphX performs type comparison incorrectly
> -------------------------------------------
>
>                 Key: SPARK-1552
>                 URL: https://issues.apache.org/jira/browse/SPARK-1552
>             Project: Spark
>          Issue Type: Bug
>          Components: GraphX
>            Reporter: Ankur Dave
>            Assignee: Ankur Dave
>
> In GraphImpl, mapVertices and outerJoinVertices use a more efficient implementation when the map function preserves vertex attribute types. This is implemented by comparing the ClassTags of the old and new vertex attribute types. However, ClassTags store _erased_ types, so the comparison will return a false positive for types with different type parameters, such as Option[Int] and Option[Double].
> Thanks to Pierre-Alexandre Fonta for reporting this bug on the [mailing list|http://apache-spark-user-list.1001560.n3.nabble.com/GraphX-Cast-error-when-comparing-a-vertex-attribute-after-its-type-has-changed-td4119.html].
> Demo in the Scala shell:
> scala> import scala.reflect.{classTag, ClassTag}
> scala> def typesEqual[A: ClassTag, B: ClassTag](a: A, b: B): Boolean = classTag[A] equals classTag[B]
> scala> typesEqual(Some(1), Some(2.0)) // should return false
> res2: Boolean = true
> We can require richer TypeTags for these methods, or just take a flag from the caller specifying whether the types are equal.



--
This message was sent by Atlassian JIRA
(v6.2#6252)