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

Matei Zaharia commented on SPARK-3098:
--------------------------------------

Sorry, I don't understand -- what exactly is the bug here? There's no guarantee 
about the ordering of elements in distinct(). If you're relying on zipWithIndex 
creating specific values, that's a wrong assumption to make. The question is 
just whether the *set* of elements returned by zipWithIndex is correct.

I don't think we should change our randomize() to be more deterministic here 
just because you want zipWithIndex. We have to allow shuffle fetches to occur 
in a random order, or else we can get inefficiency when there are hotspots. If 
you'd like to make sure values land in specific partitions and in a specific 
order in each partition, you can partition the data with your own Partitioner, 
and run a mapPartitions that sorts them within each one.

>  In some cases, operation zipWithIndex get a wrong results
> ----------------------------------------------------------
>
>                 Key: SPARK-3098
>                 URL: https://issues.apache.org/jira/browse/SPARK-3098
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 1.0.1
>            Reporter: Guoqiang Li
>            Priority: Critical
>
> The reproduce code:
> {code}
>      val c = sc.parallelize(1 to 7899).flatMap { i =>
>       (1 to 10000).toSeq.map(p => i * 6000 + p)
>     }.distinct().zipWithIndex() 
>     c.join(c).filter(t => t._2._1 != t._2._2).take(3)
> {code}
>  => 
> {code}
>  Array[(Int, (Long, Long))] = Array((1732608,(11,12)), (45515264,(12,13)), 
> (36579712,(13,14)))
> {code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to